Point Claude Code at otari.ai to track usage, enforce budgets, and inspect traces for every request, without changing how you work in the CLI.
How it works
Claude Code speaks the Anthropic Messages API and lets you redirect it to any compatible endpoint with a couple of environment variables. otari.ai serves that API, so you set the base URL and a workspace token and every request flows through the platform.
You keep using Claude Code exactly as before. otari.ai records usage, applies budgets, and captures traces, with no changes to your workflow.
1. Generate a workspace token
Open your workspace and go to the API Keys tab.
Under workspace tokens, click Generate.
Copy the token (it starts with
tk_). This is shown only once.
Keep it secret. Treat the token like a password and export it from your shell rather than hardcoding it.
2. Add your provider keys (optional)
To use your own upstream credentials, add them in the Providers tab under Provider Keys (BYOK) for the providers you want. Skip this if your workspace already has the keys it needs.
3. Configure Claude Code
Export these environment variables before launching Claude Code. Use ANTHROPIC_AUTH_TOKEN (sent as a bearer token), not ANTHROPIC_API_KEY:
export ANTHROPIC_BASE_URL=https://api.otari.ai export ANTHROPIC_AUTH_TOKEN=tk_your_token export ANTHROPIC_MODEL=anthropic/claude-sonnet-4-6
claude
Base URL: set it to the otari.ai root. Claude Code appends /v1/messages itself.
Model: anthropic/claude-sonnet-4-6 addresses the Anthropic provider directly, using the Anthropic key you added in Step 2. See Model format for managed models and other providers.
You can set the same values under env in ~/.claude/settings.json instead of exporting them.
Use any model, not just Claude
Claude Code speaks the Anthropic wire format, but the model is just a selector that otari.ai routes to any provider in the catalog. You are not limited to Claude models. Set the per-tier overrides so both the main agent and the background model resolve to models your workspace serves:
export ANTHROPIC_BASE_URL=https://api.otari.ai export ANTHROPIC_AUTH_TOKEN=tk_your_token export ANTHROPIC_DEFAULT_OPUS_MODEL=mzai:moonshotai/Kimi-K2.6 export ANTHROPIC_DEFAULT_SONNET_MODEL=mzai:moonshotai/Kimi-K2.6 export ANTHROPIC_DEFAULT_HAIKU_MODEL=mzai:Qwen/Qwen3-32B
claude
Model format
There are two selector forms:
Managed models (hosted by otari.ai, no provider key needed):
mzai:<catalog-id>, for examplemzai:moonshotai/Kimi-K2.6ormzai:deepseek-ai/DeepSeek-V3.2. The managed catalog is open-weight models; browse it on the Models page.Your own provider keys (BYOK, including proprietary models):
<provider>/<model>with nomzai:prefix, for exampleanthropic/claude-opus-4-8,openai/gpt-4o, ormistral/mistral-large-latest.
Adding an mzai: prefix to a proprietary model routes it to the managed catalog instead of your key, so it will not resolve.
Quality caveat: routing works for any provider, but Claude Code's prompts and tool-use loop are tuned for Claude models. Other models run fine through the gateway but may produce weaker tool calling and agentic behavior, and Anthropic-only features like extended thinking and prompt caching do not carry over.
