cd /news/ai-tools/using-opencode-with-any-openai-compa… · home › topics › ai-tools › article
[ARTICLE · art-178163] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Using OpenCode With Any OpenAI-Compatible API (2026 Setup Guide)

A developer working on API Volta, an OpenAI-compatible gateway, published a setup guide for wiring the open-source terminal coding agent OpenCode to any provider that implements the OpenAI chat completions contract. The guide shows an opencode.json provider block specifying a base URL, model aliases and a default model, plus an `opencode auth login` flow for storing the bearer key, and notes that OpenCode's config schema has changed between releases. It also lists per-token pricing for six model aliases and estimates that a 200k-input, 30k-output task costs roughly $0.032 on MiniMax-M3.1-Flash versus $0.376 on Kimi-K2.7-Code, warning that input tokens dominate agent bills.

recommendation

Route OpenCode's high-volume edits and file sweeps to the cheapest alias like MiniMax-M3.1-Flash and reserve pricier models for hard refactors, since input tokens dominate agent bills and a cheap model needing one extra retry can lose its advantage.

more in playbook: Controlling LLM cost
by read2 min views4 publishedNov 29, 2026

OpenCode is an open-source terminal coding agent: it reads a repository, plans edits, calls tools and streams changes back to the terminal. Under the hood it needs three things from a provider — a base URL, a bearer key and a model id — plus reliable streaming and tool calling.

I work on API Volta, an OpenAI-compatible gateway, so this guide uses it as the example endpoint. The same provider block works with any gateway that speaks the OpenAI chat completions contract.

Create an account, open the console and add a key. Store it in your local secret manager or shell environment. Never commit the key to a repository.

OpenCode reads a project or global opencode.json. Save this at the repository root or in the global config location used by your OpenCode version:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "apivolta": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "API Volta",
      "options": { "baseURL": "https://app.apivolta.com/v1" },
      "models": {
        "DeepSeek-V4-Pro": { "name": "DeepSeek V4 Pro" },
        "Kimi-K2.7-Code": { "name": "Kimi K2.7 Code" },
        "GLM-5.3": { "name": "GLM-5.3" }
      }
    }
  },
  "model": "apivolta/DeepSeek-V4-Pro"
}

OpenCode's configuration schema has changed between releases. If an option is rejected, compare it with the OpenCode provider docs for your installed version.

Run opencode auth login, choose the custom/other provider option, enter the provider id apivolta and paste the key. Model identifiers use the provider prefix: apivolta/DeepSeek-V4-Pro.

Alias Input $/1M Output $/1M Context Role
MiniMax-M3.1-Flash 0.10 0.40 262,144 Volume edits and file sweeps
DeepSeek-V4-Flash 0.18 0.36 131,072 Fast plan-and-edit loops
Kimi-K2.6 0.65 2.68 262,144 Mixed coding and document work
DeepSeek-V4-Pro 0.67 1.34 262,144 Multi-file changes
GLM-5.3 1.16 4.06 262,144 Hard refactors and synthesis
Kimi-K2.7-Code 1.16 4.81 262,144 Coding-tuned tool loops

Prices are the published catalog rates on 2026-11-29. The live table is the source of truth: https://app.apivolta.com/pricing

If an alias loops or drops tool calls, switch aliases. The request shape stays identical, so only the model string changes.

A 200k-input + 30k-output task at published rates costs about $0.032 on MiniMax-M3.1-Flash, $0.047 on DeepSeek-V4.1-Flash, $0.174 on DeepSeek-V4-Pro and $0.376 on Kimi-K2.7-Code. Input tokens dominate agent bills, so a cheaper model that needs one extra retry can lose its advantage.

API Volta — one OpenAI-compatible endpoint, published USD per-token pricing, prepaid Pay-As-You-Go with a one-time trial quota for new accounts, optional 30-day Memberships from $19 (daily allowance resets at 00:00 UTC), and a $5 / 72-hour Unlimited Day Pass on DeepSeek V4.1 Flash with up to 5 parallel requests. Top-ups start at $5 by card or $3 in USDT.

── more in #ai-tools 4 stories · sorted by recency
── more on @opencode 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/using-opencode-with-…] indexed:0 read:2min 2026-11-29 · —