Indicia Code.

Chat completions

Create a model response in the OpenAI Chat Completions format, over a model class or a direct model.

Endpoint
POST https://code.test.indicia-ai.com/v1/chat/completions

Creates a model response for a conversation, in the OpenAI Chat Completions format, over a model class or a direct model.

Request body

ParameterTypeDescription
modelstring, requiredA model class id, such as indicia/snel, or a direct model id, such as claude-sonnet-5-5. See Models.
messagesarray, requiredAt least one message. Roles: system, developer (treated as system), user, assistant, tool.
streambooleanStream the response as server-sent events. Default false.
stream_options.include_usagebooleanWith stream, send a final chunk with usage.
max_completion_tokensintegerMaximum output tokens. Wins over max_tokens. Claude defaults to 32000. ChatGPT candidates ignore it.
max_tokensintegerSame as max_completion_tokens.
stopstring or arrayStop sequences. ChatGPT candidates ignore them.
toolsarrayFunction tools. See Function calling.
tool_choicestring or objectnone, auto, required, or {"type": "function", "function": {"name": "..."}}.
parallel_tool_callsbooleanAllow more than one tool call per turn.
response_formatobjecttext, json_object or json_schema. See Structured output.
reasoning_effortstringnone, minimal, low, medium, high, xhigh, max or ultra. How long the model reasons before it answers. Default: the class's effort. See Reasoning effort.
temperature, top_pnumberAccepted and ignored.
nintegerOnly 1.

Message content is a string or an array of parts. Every role takes text parts. user messages also take image_url parts; see Images. assistant messages may carry tool_calls, and tool messages need a tool_call_id.

Other parameters, such as seed or logprobs, are ignored. The body may be up to 16 MiB.

An optional session-id request header keeps requests with the same value on the same ChatGPT account, which helps prompt caching on that provider.

Example request

Terminal
curl https://code.test.indicia-ai.com/v1/chat/completions \
  -H "Authorization: Bearer $INDICIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "indicia/snel",
    "messages": [
      {"role": "system", "content": "Answer in one sentence."},
      {"role": "user", "content": "What is the capital of the Netherlands?"}
    ]
  }'

Response

A chat.completion object with one choice. finish_reason is stop, length, tool_calls or content_filter. usage is present when the provider reports it. usage.completion_tokens_details.reasoning_tokens counts the reasoning tokens inside completion_tokens. The reasoning itself is never returned.

Response
{
  "id": "chatcmpl-cdcba86b-228c-4aa5-b32d-779d0fc8bda0",
  "object": "chat.completion",
  "created": 1791898179,
  "model": "indicia/snel",
  "choices": [
    {
      "index": 0,
      "message": {"role": "assistant", "content": "The capital of the Netherlands is Amsterdam."},
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 23,
    "completion_tokens": 12,
    "total_tokens": 35,
    "prompt_tokens_details": {"cached_tokens": 0},
    "completion_tokens_details": {"reasoning_tokens": 0}
  }
}

The x-indicia-provider and x-indicia-model headers name the provider and model that answered; see Response headers.

Streaming

With "stream": true the response is text/event-stream. Each event is a data: line with a chat.completion.chunk. The first chunk carries the role, then content or tool call deltas follow, then a chunk with finish_reason. With include_usage, a last chunk has empty choices and the usage. The stream ends with data: [DONE].

Terminal
curl https://code.test.indicia-ai.com/v1/chat/completions \
  -H "Authorization: Bearer $INDICIA_TOKEN" \
  -H "Content-Type: application/json" \
  -N \
  -d '{
    "model": "indicia/snel",
    "stream": true,
    "stream_options": {"include_usage": true},
    "messages": [{"role": "user", "content": "Say hello"}]
  }'
Stream
data: {"id":"chatcmpl-68ae…","object":"chat.completion.chunk","created":1791897915,"model":"indicia/snel","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-68ae…","object":"chat.completion.chunk","created":1791897915,"model":"indicia/snel","choices":[{"index":0,"delta":{"content":"Hello!"},"finish_reason":null}]}

data: {"id":"chatcmpl-68ae…","object":"chat.completion.chunk","created":1791897915,"model":"indicia/snel","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: {"id":"chatcmpl-68ae…","object":"chat.completion.chunk","created":1791897915,"model":"indicia/snel","choices":[],"usage":{"prompt_tokens":8,"completion_tokens":6,"total_tokens":14}}

data: [DONE]

On this page