Estimate Messages input tokens
Returns the input-token estimate used by compatible coding-agent clients. Requires an authenticated Codius API key.
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.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/messages/count_tokens" \ -H "Content-Type: application/json" \ -d '{}'{ "input_tokens": 1}Errors, limits, and request IDs
Handle Codius API errors safely and make support reports actionable.
Create a chat completion POST
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.