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/completions

Unlike 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

ParameterTypeNotes
modelstringRequired. A catalog model ID from GET /models.
promptstringRequired. Raw text the model continues.
max_tokensintegerCap on generated tokens.
sampling parameterstemperature, top_p, frequency_penalty, presence_penalty, stop, seed (plus top_k/min_p extensions) behave as on chat completions.
streambooleanServer-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.

Completions (legacy), API reference, Pearl Inference Docs