LatentKit

Completions

POST /v1/complete — single-prompt text completion through the assigned route.

POST /v1/complete is the simplest text endpoint: one prompt in, one completion out. Use it for single-shot generation where you do not need a conversation history. For multi-turn conversations, tools, or JSON mode, use Chat.

Request

curl https://ai.latentkit.com/v1/complete \
  -H "Authorization: Bearer $LATENTKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a one-line description of LatentKit.",
    "system": "Respond in plain English.",
    "max_tokens": 100
  }'

Fields

FieldDescription
promptText to complete (required)
systemOptional system instruction
max_tokensOutput token limit (default 1000)
temperatureSampling temperature (default 0.7)
streamSet true for SSE streaming — see Streaming
response_profilefast, balanced, or deep when the route allows overrides

SDK

const response = await client.completions.create({
  prompt: 'Write a one-line description of LatentKit.',
  system: 'Respond in plain English.',
});

console.log(response.content);
response = client.completions.create(
    prompt="Write a one-line description of LatentKit.",
    system="Respond in plain English.",
)

print(response["content"])

Streaming is available via client.completions.stream(...) in both SDKs.

Response

Completions use the same response envelope as chat: content, id, provider, model, policy_version_id, and usage. See Response contract.

Chat vs complete

Use /v1/complete whenUse /v1/chat when
One prompt, one answerMulti-turn conversation with history
Simple text generationTool calling, JSON mode, or multimodal input
Minimal request bodyFine-grained sampling controls (top_p, stop, seed, …)

Both endpoints require a route model with the text capability and follow identical routing, billing, and error rules.

On this page