Inference and catalogue routes

Chat Completions, Responses, Messages and token counting, plus the public model and plan catalogue.

POST /api/v1/chat/completions

OpenAI-compatible chat. Set stream: true for server-sent events.

Auth
Session or API key
Body / query
model, messages[] (roles system/user/assistant/tool), stream, temperature 0-2, max_tokens, tools[], tool_choice, reasoning_effort
Response
OpenAI chat completion plus a swarm block (credits_debited, credit_balance_after, usage_event_id, token_source, cached_tokens, dropped_params)
Errors
400, 401, 402, 422, 429, 502

POST /api/v1/responses

OpenAI Responses API. Accepts input as text or items, function calls and reasoning.effort.

Auth
Session or API key
Body / query
model, input, instructions, tools, stream, reasoning
Response
Responses object plus the swarm block
Errors
400, 401, 402, 422, 429, 502

POST /api/v1/messages

Anthropic-style Messages route. Authenticate with x-api-key or Bearer.

Auth
Session or API key
Body / query
model, max_tokens (required), messages[] (user/assistant), system, tools[], stream
Response
Anthropic message plus the swarm block. Image and document blocks are rejected
Errors
400, 401, 402, 422, 429, 502

POST /api/v1/messages/count_tokens

Estimate input tokens for a Messages request. Debits nothing.

Auth
Session or API key
Body / query
Same shape as Messages
Response
{input_tokens}
Errors
400, 401

Catalogue

GET /api/v1/models

Enabled models with credit multipliers, context window and output cap.

Auth
None
Body / query
—
Response
{models:[{id, provider, display_name, input_credit_multiplier, output_credit_multiplier, context_window, max_output_tokens}]}
Errors
—

GET /api/v1/models/openai

The same models in OpenAI list shape for SDKs that call models.list().

Auth
None
Body / query
—
Response
{object:'list', data:[{id, object:'model', owned_by}]}
Errors
—

GET /api/v1/plans

Credit packs you can buy (what checkout charges).

Auth
None
Body / query
—
Response
{plans:[{id, name, price_cents, currency, credits}]}
Errors
—

GET /api/plans

Display catalogue, proxied from the central Thundera plan catalogue (60 s cache).

Auth
None
Body / query
—
Response
{plans:[{id, tier, billing_period, name, unit_amount_cents, currency, features[], limits}]}
Errors
—
Source of truth: the Swarm repository