Documentation
Make your first request
The tocara API is compatible with the OpenAI Chat Completions format and the Anthropic Messages format. If you already use either SDK, change the base URL and API key.
Quickstart
- Create an account and add credits on the Billing page.
- Create an API key on the API keys page and store it as an environment variable.
- Send a request:
export TOCARA_API_KEY="tk-..."curl https://tocara.ai/v1/chat/completions \
-H "Authorization: Bearer $TOCARA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4",
"messages": [{"role": "user", "content": "Hello!"}]
}'Authentication
Send your key in the Authorization header as Bearer tk-.... The x-api-key header is also accepted for Anthropic-style clients. Keys are shown once when created; we store only a hash.
https://tocara.ai/v1Chat completions
POST /v1/chat/completions accepts the standard OpenAI request body: model, messages, temperature, max_tokens, tools, stream and so on. Parameters are passed to the model as-is; support for individual parameters depends on the model.
Messages (Anthropic format)
POST /v1/messages accepts the Anthropic Messages format for models that list the /messages endpoint on the models page. No models currently use this endpoint.
curl https://tocara.ai/v1/messages \
-H "x-api-key: $TOCARA_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "MODEL_ID",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'Streaming
Set "stream": true to receive server-sent events. On the chat completions endpoint the final event includes a usage object so you can see the token counts used for billing.
Listing models
GET /v1/models returns every active model in the OpenAI list format, with its provider and supported endpoints. The models page shows prices.
curl https://tocara.ai/v1/modelsErrors
Errors use the same shape as the format you called. Every response includes an x-request-id header.
| Status | Type | Meaning |
|---|---|---|
| 400 | invalid_request_error | The body is not valid JSON, or a required field such as model is missing. |
| 401 | authentication_error | The API key is missing, wrong or revoked. |
| 402 | insufficient_credits | Your balance is empty. Add credits in the dashboard. |
| 404 | model_not_found | The model id is not available. Check /v1/models. |
| 429 | key_limit_reached | This key has reached its monthly spending limit. |
| 5xx | upstream_error | The model provider failed. These requests are not charged; retry with backoff. |
Billing & usage
Each successful request is charged from your credit balance using the token counts the model reports and the prices on the models page. Failed requests are logged at $0. You can see every request, its tokens and its cost on the Usage page of your dashboard.