API Reference
Completions (legacy)
Raw-prompt text completion, the pre-chat OpenAI shape, served for tooling that still speaks it.
Endpoint
POST https://inference.pearlresearch.ai/v1/completionsUnlike chat completions, the prompt string is handed to the model as-is, no chat template, no roles, no system prompt. The model simply continues your text. Streaming works the same way as on the chat endpoint.
Request body
| Parameter | Type | Notes |
|---|---|---|
| model | string | Required. A catalog model ID from GET /models. |
| prompt | string | Required. Raw text the model continues. |
| max_tokens | integer | Cap on generated tokens. |
| sampling parameters | — | temperature, top_p, frequency_penalty, presence_penalty, stop, seed (plus top_k/min_p extensions) behave as on chat completions. |
| stream | boolean | Server-sent events with choices[0].text deltas, terminated by data: [DONE]. |
Example
curl https://inference.pearlresearch.ai/v1/completions \
-H "Authorization: Bearer $PEARL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "zai-org/GLM-5.2",
"prompt": "The three laws of robotics are:",
"max_tokens": 200,
"temperature": 0.7
}'{
"id": "cmpl-…",
"object": "text_completion",
"created": 1785229039,
"model": "zai-org/GLM-5.2",
"choices": [
{"index": 0, "text": " 1. A robot may not injure …", "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 9, "completion_tokens": 74, "total_tokens": 83}
}The models in the catalog are instruction-tuned, and their quality comes from their chat formatting, prefer chat completions for anything conversational, and keep this endpoint for continuation-style tasks or legacy integrations that require the prompt/text shape.