TeepinDocs

Chat completions

Send messages, get an answer back whole or as a stream, and read the response headers.

POST /v1/chat/completions follows OpenAI's chat completions API.

One answer

curl https://api.teepin.com/v1/chat/completions \
  -H "Authorization: Bearer $TEEPIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "teepin/glm-5.3",
    "messages": [
      {"role": "system", "content": "Be brief."},
      {"role": "user", "content": "What is TLS?"}
    ],
    "max_tokens": 300,
    "chat_template_kwargs": {"enable_thinking": false}
  }'

Request fields

FieldNotes
modelRequired. An id from the model list.
messagesRequired, not empty. Roles system, user, assistant and tool. Content is a string or OpenAI content parts, for example {"type": "image_url", "image_url": {"url": "..."}}.
max_tokens or max_completion_tokensThe answer's token budget. If both are sent, max_completion_tokens wins.
stream, stream_optionsStream the answer. {"include_usage": true} adds token counts to the last chunk.
temperature, top_p, top_k, min_p, seed, stop, nSampling.
frequency_penalty, presence_penalty, repetition_penalty, logit_biasPenalties and biases.
logprobs, top_logprobsToken log probabilities.
tools, tool_choice, response_formatTool calls and structured output, where the model supports them.
userYour own identifier for the end user.
chat_template_kwargsTemplate options, for example {"enable_thinking": false}. See Reasoning models.

Any other field is ignored.

Streaming

With "stream": true the answer arrives as server-sent events: one data: {...} line per chat.completion.chunk, ending with data: [DONE].

curl -N https://api.teepin.com/v1/chat/completions \
  -H "Authorization: Bearer $TEEPIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "teepin/glm-5.3",
    "messages": [{"role": "user", "content": "Write a haiku about the sea."}],
    "stream": true,
    "stream_options": {"include_usage": true}
  }'

If the model fails part way through, the stream sends data: {"error": {...}} and closes without [DONE]. A stream that closes without [DONE] and without an error frame was cut off. The SDKs raise an error in both cases, so a partial answer is never mistaken for a whole one.

Response headers

HeaderMeaning
X-Request-IDQuote it when you contact support.
X-Teepin-AttestationFor confidential models: verified, verified-older-release or not-verified. See Confidential models.
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-ResetYour current window. See Rate limits.

Billing

Each answer is billed by its input and output tokens at the model's prices, from your prepaid credit. An answer is billed once the model has written it, even if your client has gone. A request refused with an error is not billed. See Billing.

On this page