v106

OpenAPI 3.1.0raw.githubusercontent.com2026-08-02160524464.6 KB
Completions

Create Completion

Generate a text completion. Set stream: true for SSE streaming.

All SSE frames use event: stream_event with a JSON-serialized StreamEvent payload. StreamEvent types: stream_start, text_start, text_delta, text_end, tool_call_start, tool_call_delta, tool_call_end, finish, error.

post/api/v1/completions

Request body

modelstring

Model ID or alias. Server picks a ready-provider default if omitted.

systemstring

System prompt (convenience; prepended as a system message).

streamboolean

Stream response via SSE.

{"stackTrail":"components:schemas:CreateCompletionRequest:properties:schema","oasType":"schema","type":"unknown","description":"JSON Schema for structured output."}
temperaturenumber double
max_tokensinteger
top_pnumber double
stop_sequencesstring[]

Stop sequences.

reasoning_effort'low' | 'medium' | 'high' | 'xhigh' | 'max'

Native reasoning-effort level requested for an LLM call.

providerstring

Optional provider pin.

{"stackTrail":"components:schemas:CreateCompletionRequest:properties:provider_options","oasType":"schema","type":"unknown","description":"Provider-specific options."}

Response

Completion result (JSON when stream=false, SSE when stream=true)

idstring required
modelstring required

Canonical model ID selected for the request.

providerstring required

LLM provider identifier.

stop_reasonstring required

Why generation stopped (end_turn, max_tokens, tool_calls).

{"stackTrail":"components:schemas:CompletionResponse:properties:output","oasType":"schema","type":"unknown","description":"Parsed structured output when schema was provided."}
cost_usdnumber double

USD cost of the completion when known: estimated from catalog prices unless the provider returned authoritative billing data.

cost_source'authoritative' | 'estimated'

Whether cost_usd came from provider billing data (authoritative) or catalog price estimation (estimated).

Example response

{
  "provider": "anthropic"
}