API Reference

June 12, 2026 ยท View on GitHub

All endpoints are under http://localhost:8000 by default.

For full request/response schemas, see the OpenAPI spec or the interactive docs at /docs when Otari is running.

Endpoint availability

Endpoint groupStandaloneConnected to otari.ai
Health (/health*)YesYes
Chat completions (/v1/chat/completions)YesYes
Messages (/v1/messages, /v1/messages/count_tokens)YesYes
Responses (/v1/responses)YesYes
All other /v1/* endpoints in this docYesNo

Authentication

Standalone

  • Preferred header: Otari-Key: Bearer <token>
  • Back-compat headers: AnyLLM-Key, X-AnyLLM-Key
  • Authorization: Bearer <token> is also accepted

Regular API endpoints use an API key. Management endpoints use the master key.

Connected to otari.ai

  • POST /v1/chat/completions expects Authorization: Bearer <user-token>
  • Otari-Key and local API keys are not used for this path

Available in both deployment types

Health

No authentication required.

MethodPathDescription
GET/healthGeneral health check. Includes otari.ai reachability fields when connected.
GET/health/livenessKubernetes liveness probe.
GET/health/readinessKubernetes readiness probe. Checks DB (standalone) or otari.ai reachability. Returns 503 on failure.

Chat completions

MethodPathDescriptionAuth
POST/v1/chat/completionsOpenAI-compatible chat completions. Supports streaming and tool use (otari_code_execution, otari_web_search, MCP).Standalone: API key or master key. Connected: Authorization bearer token from otari.ai.

See Use with opencode for a full client setup.

Messages

MethodPathDescriptionAuth
POST/v1/messagesAnthropic Messages API-compatible endpoint. Supports streaming, tool use, and extended thinking. Routes to any provider in the catalog (non-Anthropic models are translated to/from the Messages format automatically).Standalone: API key or master key. Connected: Authorization bearer token from otari.ai.
POST/v1/messages/count_tokensAnthropic-compatible input-token count for a Messages request. Returns {"input_tokens": N}. Counts locally (no provider call, no budget debit); the count is an approximation. Used by clients such as Claude Code for context-window management.Standalone: API key or master key. Connected: Authorization bearer token from otari.ai.

See Use with Claude Code for a full client setup.

Responses

MethodPathDescriptionAuth
POST/v1/responsesOpenAI Responses API-compatible endpoint. Supports streaming.Standalone: API key or master key. Connected: Authorization bearer token from otari.ai.

Standalone-only endpoints

Embeddings

MethodPathDescriptionAuth
POST/v1/embeddingsGenerate embeddings for text input.API key or master key

Models

MethodPathDescriptionAuth
GET/v1/modelsList available models from pricing entries.API key or master key
GET/v1/models/{model_id}Get a specific model.API key or master key

Moderations

MethodPathDescriptionAuth
POST/v1/moderationsOpenAI-compatible content moderation.API key or master key

Rerank

MethodPathDescriptionAuth
POST/v1/rerankReorder documents by relevance to a query.API key or master key

Images

MethodPathDescriptionAuth
POST/v1/images/generationsGenerate images from text prompts.API key or master key

Audio

MethodPathDescriptionAuth
POST/v1/audio/transcriptionsTranscribe audio to text (multipart upload).API key or master key
POST/v1/audio/speechGenerate speech from text (TTS).API key or master key

Files

OpenAI-compatible file storage. Upload a file, then reference it from a chat request by file_id. See files.md for how uploaded files are turned into something a text-only local model can read.

MethodPathDescriptionAuth
POST/v1/filesUpload a file (multipart: file, purpose). Returns a file object with an id.API key or master key
GET/v1/filesList the caller's files. Query params: purpose.API key or master key
GET/v1/files/{file_id}Get file metadata.API key or master key
GET/v1/files/{file_id}/contentDownload the raw file bytes.API key or master key
DELETE/v1/files/{file_id}Delete a file.API key or master key

Batches

MethodPathDescriptionAuth
POST/v1/batchesCreate an async batch of LLM requests.API key or master key
GET/v1/batchesList batches. Query param: provider.API key or master key
GET/v1/batches/{batch_id}Get batch status. Query param: provider.API key or master key
POST/v1/batches/{batch_id}/cancelCancel a batch. Query param: provider.API key or master key
GET/v1/batches/{batch_id}/resultsGet batch results. Returns 409 if not complete. Query param: provider.API key or master key

Key management

MethodPathDescriptionAuth
POST/v1/keysCreate an API key.Master key
GET/v1/keysList all API keys.Master key
GET/v1/keys/{key_id}Get a specific key.Master key
PATCH/v1/keys/{key_id}Update a key (name, active status, expiration, metadata).Master key
DELETE/v1/keys/{key_id}Revoke a key.Master key

User management

MethodPathDescriptionAuth
POST/v1/usersCreate a user.Master key
GET/v1/usersList users.Master key
GET/v1/users/{user_id}Get a specific user.Master key
PATCH/v1/users/{user_id}Update a user.Master key
DELETE/v1/users/{user_id}Soft-delete a user and deactivate their keys.Master key
GET/v1/users/{user_id}/usageGet usage history for a user.Master key

Budget management

MethodPathDescriptionAuth
POST/v1/budgetsCreate a budget.Master key
GET/v1/budgetsList budgets.Master key
GET/v1/budgets/{budget_id}Get a specific budget.Master key
PATCH/v1/budgets/{budget_id}Update a budget.Master key
DELETE/v1/budgets/{budget_id}Delete a budget.Master key

Pricing

MethodPathDescriptionAuth
POST/v1/pricingSet or update model pricing.Master key
GET/v1/pricingList all model pricing.API key or master key
GET/v1/pricing/{model_key}Get effective pricing for a model. Optional as_of query param.API key or master key
GET/v1/pricing/{model_key}/historyGet full pricing history for a model.API key or master key
DELETE/v1/pricing/{model_key}Delete a pricing entry.Master key

Usage

MethodPathDescriptionAuth
GET/v1/usageList usage logs. Filters: start_date, end_date, user_id.Master key