Create a chat completion
Creates a model response for a conversation. Requires the
inference:create scope.
Set stream: true to receive Server-Sent Events. The stream emits
chat.completion.chunk objects and terminates with exactly one
data: [DONE] marker. Pass stream_options.include_usage: true to
receive a final chunk carrying the token usage block.
Requests that use a capability the target model does not support are
rejected with unsupported_feature rather than silently degraded.
Only n: 1 is supported.
Authorization
apiKey A Codius organization API key, sent as
Authorization: Bearer codius_live_….
Keys carry a subset of the models:read, inference:create, and
usage:read scopes — never billing or admin permissions.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
A public model ID from GET /v1/models.
1 <= length <= 256Value in
- "anthropic/claude-haiku-4.5"
- "anthropic/claude-opus-4.7"
- "anthropic/claude-opus-4.8"
- "anthropic/claude-sonnet-4.6"
- "deepseek/v4-flash"
- "deepseek/v4-pro"
- "google/gemini-3.1-flash-lite"
- "google/gemini-3.1-pro"
- "google/gemini-3.5-flash"
- "google/gemini-3-flash"
- "google/gemma-4-31b"
- "minimax/m3"
- "moonshotai/kimi-k2.6"
- "moonshotai/kimi-k3"
- "openai/gpt-5.4"
- "openai/gpt-5.4-mini"
- "openai/gpt-5.4-nano"
- "xai/grok-4.3"
- "zai/glm-5.1"
1 <= items <= 2000Stream the response as Server-Sent Events.
falseRequires stream: true.
Mutually exclusive with max_completion_tokens.
1 <= valueMutually exclusive with max_tokens.
1 <= value0 <= value <= 20 <= value <= 11 <= items <= 128Requires tools.
Requires a model with reasoning support.
Value in
- "none"
- "minimal"
- "low"
- "medium"
- "high"
- "xhigh"
-2 <= value <= 2-2 <= value <= 2Only a single choice is supported.
1Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "moonshotai/kimi-k3", "messages": [ { "role": "user", "content": "Explain this function." } ] }'{ "id": "chatcmpl_0190d3a0", "object": "chat.completion", "created": 1753267200, "model": "MODEL_ID", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "It memoizes the result of the previous render." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 24, "completion_tokens": 11, "total_tokens": 35 }}Estimate Messages input tokens POST
Returns the input-token estimate used by compatible coding-agent clients. Requires an authenticated Codius API key.
Create a Messages-compatible response POST
Messages-compatible adapter used when Codius App runs Claude Code with Codius models. It uses the same authorization, metering, limits, and request IDs as Chat Completions. Requires the `inference:create` scope.