Browse documentation
API reference

Legacy completions

Connect clients that send prompt and read choices[].text.

POST /v1/completions

cURL
curl "https://kavren.dev/v1/completions" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek-v4.1-flash-fast",
  "prompt": "Reply with the name of one planet.",
  "max_tokens": 64
}'
Example response · selected fields
{
  "object": "text_completion",
  "model": "deepseek-v4.1-flash-fast",
  "choices": [
    {
      "index": 0,
      "text": "Mars",
      "finish_reason": "stop"
    }
  ]
}

A string array is joined with line breaks into a single prompt. Pricing and key limits follow Chat Completions. Use Chat Completions for tool calls.

Stream text

cURL
curl -N "https://kavren.dev/v1/completions" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek-v4.1-flash-fast",
  "prompt": "Reply with the name of one planet.",
  "stream": true,
  "max_tokens": 64
}'

Append choices[].text from each SSE chunk until [DONE]. A retry with the same Idempotency-Key replays from the start when the receipt is available.

Search Kavren