otari

mozilla-aiApache-2.0活跃维护

自托管的开源 AI 网关,把 40 多家模型提供商统一到一个接口,并自带虚拟密钥、预算控制和用量统计,省去多平台对接与成本管理麻烦。

Open-source AI gateway you run yourself. One endpoint for 40+ providers, with virtual keys, budgets, and usage tracking.

v0.41.0发布于 2026-11-09 16:27 UTC894star +29 / 7 天122fork同步于 2026-11-10 11:54 UTC

怎么上手

由 README 提炼,执行前请确认
docker run --rm -p 8000:8000 -e OPENAI_API_KEY=YOUR_OPENAI_KEY -e OTARI_CONFIG_YAML='default_pricing: true
providers:
  openai:
    api_key: ${OPENAI_API_KEY}
' mzdotai/otari:latest otari serve
硬件要求按 README 说明

README 未说明具体硬件要求;提供 Docker 镜像与 Compose 部署,Compose 默认使用 PostgreSQL,本地开发可改用 SQLite。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

自托管的 AI 网关,用一个端点接入 40+ 模型提供商,统一管理密钥、预算与用量

自托管的开源 AI 网关,把 40 多家模型提供商统一到一个接口,并自带虚拟密钥、预算控制和用量统计,省去多平台对接与成本管理麻烦。

核心能力

  • 用单一 OpenAI/Anthropic 兼容端点路由 40+ 提供商
  • 签发可撤销虚拟密钥,按用户、工作区和模型限定范围
  • 派发前校验预算,结算后记录用量
  • 本地路由策略支持故障转移、条件选择、流量拆分与限流溢出
  • 可选代码执行、联网搜索、MCP、推理护栏与文件理解

容易踩的坑

首次启动空数据库时会生成并只打印一次 bootstrap API key,需立即保存;临时 Docker 容器内用 SQLite,停止即丢数据,持久化要用 Compose;通过仪表盘存提供商密钥需先设置 OTARI_SECRET_KEY 为 Fernet 密钥,Compose 还需在 .env 中配置 OTARI_PROVIDER_ACCOUNT_PEPPER。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.41.0
  1. v0.41.0最新正式版2026-11-09 · 2026-11-09 16:27 UTC

    0.41.0 - 2026-11-09

    Bug Fixes

  2. v0.40.02026-11-06 · 2026-11-06 18:57 UTC
    查看更新说明

    0.40.0 - 2026-11-06

    Bug Fixes

    Features

    • pricing: Price a pass-through report at its rate's slot by @dpoulopoulos (8e44bd0)
    • pricing: Price a catalog model that has no text price by @dpoulopoulos (ed11706)
    • api: Measure what each pass-through endpoint bills by @dpoulopoulos (ea070e2)
    • pricing: Price a provider-run search at the model's own rate by @dpoulopoulos (997bb95)
    • web: Set a budget's token and request limits from the dashboard by @daavoo (0f6ec30)
    • BREAKING: providers: Name an organization key with its own endpoint by a request prefix by @daavoo (f7fa290)
    • key: Let an API key read its own budget and usage by [
  3. v0.39.02026-11-05 · 2026-11-05 13:35 UTC
    查看更新说明

    0.39.0 - 2026-11-05

    Bug Fixes

  4. v0.38.02026-11-04 · 2026-11-04 15:36 UTC
    查看更新说明

    0.38.0 - 2026-11-04

    Bug Fixes

    Features

    New Contributors

    Full Changelog: https://github.com/mozilla-ai/otari/compare/v0.37.0...v0.38.0

  5. v0.37.02026-11-04 · 2026-11-04 08:01 UTC
    查看更新说明

    0.37.0 - 2026-11-04

    Bug Fixes

    Features

    Maintenance

    Performance

    New Contributors

    Full Changelog: https://github.com/mozilla-ai/otari/compare/v0.36.0...v0.37.0

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    An AI gateway you own and run.

    Route one endpoint to 40+ providers, issue virtual keys, enforce budgets, and track usage.

    Tests Lint Typecheck Docker Python 3.13+

    Docs · otari.ai · Launch blog · Discord

    [!NOTE] Developers Wilding, our AI hackathon at MozFest, runs until November 11. Build something with Otari and open-weight models for a chance at the $1,000 prize (plus runner-up prizes) and dedicated time with our AI engineers. Details and submissions.

    Otari sits between your applications and model providers. It authenticates requests, resolves provider credentials, enforces budgets before dispatch, and records usage afterwards. Provider calls go through any-llm.

    Run Otari with your own database and provider keys.

    Why Otari

    • One OpenAI and Anthropic-compatible endpoint for many providers
    • Provider credentials stay behind the gateway
    • Revocable API keys with user, workspace, and model scope
    • Budget checks before spend and usage records after settlement
    • Local routing policies for failover, conditional selection, traffic splitting, and spill-over past a rate limit
    • Optional code execution, web search, MCP, inference guardrails, and file understanding

    Quickstart

    Run an ephemeral gateway with Docker:

    docker run --rm -p 8000:8000 \
      -e OPENAI_API_KEY=YOUR_OPENAI_KEY \
      -e OTARI_CONFIG_YAML='
    default_pricing: true
    providers:
      openai:
        api_key: ${OPENAI_API_KEY}
    ' \
      mzdotai/otari:latest \
      otari serve
    

    On the first empty database, Otari creates an API key and prints it once:

    No API keys found. Created bootstrap key for first run. Save this key now:
    tk-...
    

    Send a request with that key:

    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."}]
      }'
    

    OpenAI clients work by setting base_url to http://localhost:8000/api/v1.

    This container uses SQLite inside the container and is deleted when it stops. Use the Compose setup below for persistent data.

    The command a developer runs next to a coding agent (otari hook, otari import claude-code) installs on its own, without the server:

    brew install mozilla-ai/tap/otari
    

    See Agent Guardrails and Use with Claude Code.

    Run the full stack

    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.
    # Provider copies of attached files are off until they have a pepper of their own. Compose reads .env.
    grep -qs OTARI_PROVIDER_ACCOUNT_PEPPER .env || echo "OTARI_PROVIDER_ACCOUNT_PEPPER=$(openssl rand -base64 32)" >> .env
    docker compose pull
    docker compose up -d
    

    Compose runs Otari with PostgreSQL. Optional profiles add the code sandbox, web search, and guardrail services:

    docker compose --profile code-exec --profile web-search --profile guardrails up -d
    

    The dashboard is served at http://localhost:8000/. To store provider keys through the dashboard, set OTARI_SECRET_KEY to a Fernet key generated by otari gen-secret-key.

    A one-click deployment template is available for Railway.

    API and dashboard

    The core completion routes are:

    • POST /api/v1/chat/completions
    • POST /api/v1/messages
    • POST /api/v1/responses

    Otari also serves the broader OpenAI-compatible and management APIs. The running server publishes Swagger UI at /api/v1/docs and OpenAPI at /api/v1/openapi.json. See API reference.

    The dashboard manages providers, models, routing, tools, keys, members, budgets, settings, activity, and usage. Its navigation adapts to the signed-in person's authority. See Admin dashboard.

    Development

    git clone https://github.com/mozilla-ai/otari
    cd otari
    uv sync --dev
    cp config.example.yml config.yml
    uv run otari serve --config config.yml
    

    For local development without PostgreSQL, change database_url to sqlite+aiosqlite:///./otari.db.

    Common checks:

    make test
    make lint
    make typecheck
    

    See CONTRIBUTING.md before opening a pull request.

    Documentation

    License

    Apache 2.0. See LICENSE.