█

AI/TLDR

Buy me a coffee
Buy me a coffee

Otari

Mozilla.ai's self-hosted AI gateway with virtual keys, budgets and routing policies

Gateways & RoutingOpen source
Latest
v0.60.0
Updated
1 Dec 2026
Language
Python
License
Apache-2.0

What's new

v0.60.01 Dec 2026

The inference country gate can hold more than one account country, the dashboard sidebar was simplified, and Rules were renamed Guardrails in the web UI.

IN SHORT

What is Otari?

Otari is an open-source AI gateway from Mozilla.ai that you run on your own infrastructure. It sits between your applications and the model providers: it authenticates each request, resolves the provider credentials, enforces budgets before the call is dispatched and records usage afterwards. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in Python and licensed Apache-2.0.

Updated Markdown version ↗

Overview

Otari is an open-source AI gateway from Mozilla.ai that you run on your own infrastructure. It sits between your applications and the model providers: it authenticates each request, resolves the provider credentials, enforces budgets before the call is dispatched and records usage afterwards. Applications talk to one OpenAI- and Anthropic-compatible endpoint that fronts 40+ providers, and the provider calls themselves go through Mozilla.ai's any-llm library.

Its job is to keep provider keys and spending under the operator's control. Clients get revocable API keys scoped to a user, a workspace and a set of models, so they never see the upstream credentials; budgets are checked before spend and settled after it. A web dashboard manages providers, models, routing, tools, keys, members, budgets, activity and usage, and the running server publishes Swagger UI and an OpenAPI document for its completion and management APIs.

The Otari dashboard Overview page showing spend today, 30-day spend, requests, error rate, budget health, a daily spend chart and recent activity by model and key.
The Overview page: spend, traffic, error rate and budget health across the gateway.Otari README demo ↗

Routing is expressed as policies: a caller-facing model name that resolves to one or more real models, used for failover, conditional selection, weighted traffic splitting and spill-over past a rate limit. Optional services add server-side code execution, web search, MCP, inference guardrails and file understanding. Mozilla.ai announced Otari in May 2026 together with Otari.ai, a hosted platform built on the same engine.

What it does

  • One OpenAI- and Anthropic-compatible endpoint (`/api/v1/chat/completions`, `/api/v1/messages`, `/api/v1/responses`) for 40+ providers
  • Revocable virtual API keys scoped by user, workspace and model, with provider credentials kept behind the gateway
  • Budget checks before a request is dispatched and usage records after it settles
The Otari Routing page listing four policies, coding, fast, smart and thrifty, with their fallback, weighted and dynamic targets.
Routing policies: failover, weighted splits and per-request selection behind one model name.Otari README demo ↗
  • Routing policies for failover, conditional selection, weighted traffic splitting and spill-over past a rate limit
  • Optional code execution sandbox, web search, MCP, inference guardrails and file understanding
  • Dashboard for providers, models, routing, keys, members, budgets, activity and usage, plus a model Playground
  • Single Docker container on SQLite, or Docker Compose on PostgreSQL

Getting started

The README's quickstart runs the whole gateway from one Docker image with no configuration; the Compose setup adds PostgreSQL and the optional services.

Start the gateway

The `otari` volume keeps the SQLite database and the key that encrypts stored provider credentials, so a new container with the same volume keeps its data.

bashbash
docker run -v otari:/data -p 127.0.0.1:8000:8000 mzdotai/otari:latest

Finish setup in the dashboard

On first start Otari prints a one-time setup link that carries the master key. Open it, choose the email and password you will sign in with, add a provider on the Hosted providers page and enable default pricing there. Then create an API key on the API keys page.

texttext
Open this link to choose your password and finish setup:

http://localhost:8000/setup#key=otari-mk-...

Send a request

Use the key you created. OpenAI clients work by setting `base_url` to `http://localhost:8000/api/v1`.

bashbash
curl http://localhost:8000/api/v1/chat/completions \
  -H "Authorization: Bearer tk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai:gpt-4o-mini",
    "messages": [{"role": "user", "content": "Say hello."}]
  }'
The Otari Activity page with an hourly request chart and a per-request log of user, model, routing decision, API key, tokens and cost.
Activity logs every request with its routing decision, tokens and cost, but no request or response content.Otari README demo ↗

Add a failover policy

From the routing docs: callers send `model: fast`, and if the first provider fails before any response is sent, Otari tries the fallback.

yamlyaml
routing:
  policies:
    fast:
      select:
        - default: openai:gpt-5-mini
      on_failure:
        - anthropic:claude-haiku-4-5

Run the full stack

Compose runs Otari on PostgreSQL; the optional profiles add the code sandbox and web search services.

bashbash
git clone https://github.com/mozilla-ai/otari
cd otari
cp config.example.yml config.yml
# set a master key, provider credentials and pricing in config.yml
docker compose pull
docker compose up -d
docker compose --profile code-exec --profile web-search up -d

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Give teams and applications their own revocable, budget-capped keys without handing out provider credentials
  • Fail over from one provider to another, or split traffic between models, behind a single model name
  • Track spend, tokens, latency and failures per user, key and model in one place
The Otari Playground in Compare mode, sending the same question to two models side by side.
The Playground compares two models on the same prompt.Otari README demo ↗
  • Compare two models side by side in the Playground before pointing a routing policy at one

How Otari compares

Otari alongside other open-source gateways & routing tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
OmniRoute★ 91.8kA local-first AI gateway that fronts hundreds of model providers with one OpenAI-compatible endpoint, quota-aware auto-fallback, many routing strategies and prompt compression.
Free Claude Code★ 75.9kA local proxy that points Claude Code, Codex, Pi, OpenCode, Cline and other agent CLIs at 50 free, paid, subscription or local model providers, with automatic failover and an admin UI.
LiteLLM★ 64.4kA Python SDK and proxy server that gives one OpenAI-compatible API to 100+ LLM providers, with cost tracking, budgets, fallbacks, rate limiting, and an admin UI.
magpie★ 44.8kMenu bar app and local gateway that lets Claude Code, Codex, Gemini CLI and dozens of other coding agents run on any provider's model, with routing groups that fail over across accounts when a quota runs out.
Kong Gateway★ 44.4kA Lua/NGINX API gateway whose AI Gateway plugins put one universal endpoint in front of OpenAI, Anthropic, Gemini, Bedrock and other providers, with semantic routing, caching and MCP traffic governance.
9Router★ 33.1kLocal OpenAI-compatible router for coding CLIs that tracks per-provider quota, falls back from subscription to cheap to free models, and compresses tool results to cut tokens.
Experiential★ 20.6kAn open-source gateway that puts hosted, BYOK, local and custom models behind one OpenAI-compatible API, with per-identity model and spend limits and routers fitted from your own traces.
Otari★ 1kMozilla.ai's self-hosted AI gateway with virtual keys, budgets and routing policies