Menu

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

  1. Create an account and add credits on the Billing page.
  2. Create an API key on the API keys page and store it as an environment variable.
  3. Send a request:
Terminal
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.

Base URL
https://tocara.ai/v1

Chat 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
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
curl https://tocara.ai/v1/models

Errors

Errors use the same shape as the format you called. Every response includes an x-request-id header.

StatusTypeMeaning
400invalid_request_errorThe body is not valid JSON, or a required field such as model is missing.
401authentication_errorThe API key is missing, wrong or revoked.
402insufficient_creditsYour balance is empty. Add credits in the dashboard.
404model_not_foundThe model id is not available. Check /v1/models.
429key_limit_reachedThis key has reached its monthly spending limit.
5xxupstream_errorThe 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.