API reference

Chat completions

OpenAI-compatible. Works with the official OpenAI SDKs and anything built on them.

POST/v1/chat/completions

Request body

modelstringrequired

Model id from the market, for example anthropic/claude-sonnet-5.5.

messagesarrayrequired

Conversation so far. Each item has a role (system, user, assistant, tool) and content.

streamboolean

Stream tokens as server-sent events. Defaults to false.

max_tokensinteger

Upper bound on generated tokens.

temperaturenumber

Sampling temperature, 0 to 2. Passed through to the upstream.

toolsarray

Function definitions in OpenAI format. Normalised for upstreams that use a different tool schema.

Example

bash
curl https://api.useorbix.app/v1/chat/completions \
  -H "Authorization: Bearer $ORBIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-6.1-sol",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user", "content": "What does ORBIX do?"}
    ]
  }'

Response

json
{
  "id": "chatcmpl_9f2c",
  "object": "chat.completion",
  "model": "openai/gpt-6.1-sol",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "ORBIX routes AI requests and discounts them using $ORBIX trading fees." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 24, "completion_tokens": 16, "total_tokens": 40 },
  "orbix": { "list_cost": 0.00019, "discount": 0.45, "charged": 0.000105 }
}

The extra orbix object mirrors the billing headers. Standard OpenAI clients ignore it.

Streaming

With "stream": true you receive data: events with chat.completion.chunk objects, ending with data: [DONE]. The last chunk before [DONE] carries usage and orbix.