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.
1. Create an API key
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.
2. Add the provider block
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.
3. Store the key
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.
4. Pick a coding alias
| 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
5. Five checks before a long session
- Single-file edit with an exact diff.
- Multi-file rename touching imports and tests.
- Shell command with a non-zero exit, to see whether the agent recovers.
- Ambiguous request, to see whether it asks instead of guessing.
- Long-context task near the model's window, to check truncation.
If an alias loops or drops tool calls, switch aliases. The request shape stays identical, so only the model string changes.
What one task costs
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.