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
| Field | Description |
|---|---|
prompt | Text to complete (required) |
system | Optional system instruction |
max_tokens | Output token limit (default 1000) |
temperature | Sampling temperature (default 0.7) |
stream | Set true for SSE streaming — see Streaming |
response_profile | fast, 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 when | Use /v1/chat when |
|---|---|
| One prompt, one answer | Multi-turn conversation with history |
| Simple text generation | Tool calling, JSON mode, or multimodal input |
| Minimal request body | Fine-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.