惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
WordPress大学
WordPress大学
IT之家
IT之家
G
Google Developers Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler
V
V2EX
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
V
Visual Studio Blog
有赞技术团队
有赞技术团队
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网

Mozilla.ai

Introducing Agent Skills in Octonous Open Source Is Not a Virtue: It’s an Ownership Model Using Octonous as a Product Operations Manager llamafile v0.10.5 The Future of AI is Personal — But Not The Way You Think How Frontier Labs Are Building Subtle Developer Lock-In Who Cares About LLM costs? Stop Chasing New Models. Build Once and Access Them All. From Evaluation to Guardrails: What We Brought to ACM FAccT 2026 Open Models are ready for agents. Their APIs are not. Using Octonous as an AI Safety Engineer The Control Layer: Why the Next Era of AI Is About Infrastructure, Not Just Models Introducing Otari: The Open-Source LLM Control Plane Announcing transcribe.cpp Using Octonous as a Product Manager Image Classification Comes to encoderfile What is an LLM control plane? Otari: Own Your AI Stack | AI Gateway & Hosted Platform AI Got Expensive. Now What? | Mozilla.ai cq exchange: Agents without Borders The Interface Is No Longer the Product VIBE✓: First Defense for cq (Stack Overflow for Agents) Octonous Open Beta: What We've Learned and Where We're Going Sovereign AI: Control, Choice, and Beyond Geopolitics Encoderfile’s New Format: Why a “Dull” Design Wins The Real Challenge Behind Small Trade Businesses Hardening Your LLM Dependency Supply Chain cq: Stack Overflow for Agents cq: Stack Overflow for Agents llamafile Reloaded: What’s New in v0.10.0
Use the Otari Gateway with OpenCode
toto · 2026-06-08 · via Mozilla.ai
Technical Content

AI coding sessions can feel like a black box. Route OpenCode through the Otari Gateway to track costs, token usage, and model activity in real time. Get budget controls and visibility across every session without changing a single line of application code.

Use the Otari Gateway with OpenCode

AI coding sessions can feel like operating in a black box. You fire up OpenCode, pick a model, and start working. By the end of the session however, you have no idea what it actually cost you, which requests failed, or how your usage breaks down across models. Even when you're running a capable open-source model like Kimi K2.6 with a 256K context window, inference for those sessions gets expensive fast.

Routing OpenCode through Otari solves that. Every request you make to OpenCode flows through Otari, so you get per-session cost tracking, budget enforcement, and usage visibility. No changes to application code required. 

Otari sits between OpenCode and the model provider, resolves credentials server-side, and logs metadata: token counts, model names, timestamps. Your prompts and completions stay yours.

Here's how to set it up in three steps.

1. Set up your Otari account and create a key

Sign up (or log in) at otari.ai

Generate an API token

  1. Open an existing workspace (or create a new one).
  2. Navigate to the API Keys tab. 
  3. Click Generate and copy the tk_... key. 

Note: This is a one-time reveal, so store your key securely.

Your key talks to the gateway at https://api.otari.ai/v1, the OpenAI-compatible endpoint that any standard client can point to.

Optional: Add your provider key

Go to Settings → Keys → Provider Keys . Under Your Keys (BYOK), click Add and paste your upstream API key (OpenAI, Anthropic, or whichever provider you're using). Otari stores this and uses it to call the provider on your behalf. Your application never touches it directly.

2. Point OpenCode at Otari

Add Otari as a provider in your opencode.jsonc. Set baseURL to the gateway and apiKey to the tk_... key you just created:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "otari": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Otari Gateway",
      "options": {
        "baseURL": "https://api.otari.ai/v1",
        "apiKey": "tk_YOUR_OTARI_KEY..." 
      },
      "models": {
        "mzai:moonshotai/Kimi-K2.6": {
          "name": "Kimi K2.6 (via Otari)",
          "limit": { "context": 256000, "output": 32000 }
        }
      }
    }
  }
}

Tip: To avoid committing secrets to version control, it is highly recommended to pass your actual API key via an environment variable rather than hardcoding it into the JSON file.

In the above example, we are using Kimi K2.6, a model hosted by Mozilla.ai's managed mzai provider. Kimi K2.6 is an open-source, agentic model with tool calling and a 256K context window.

3. Start Coding

Pick the Otari model in OpenCode and start working:

opencode --model otari/mzai:moonshotai/Kimi-K2.6

That's it. Every request now flows through the gateway, so you get usage and strict budget tracking across all your models, without changing a single line of your application code. 

To verify everything is working, run a quick prompt and check  your Otari dashboard.You should see  usage stats appearing immediately.

Two OpenCode sessions, 8,621 tokens, $0.01. Kimi K2.6 is inexpensive to run, and now you can actually see that.