The best API for OpenCode depends on what you want to buy: a predictable allowance, a specific model, a broad catalog, or a lower usage bill. Start with Go for regular work inside its plan, Zen for a curated usage service, and direct providers or gateways when model choice and per-token pricing matter. For the cheapest route, compare the model and full payment cost, not just a provider's headline discount.
Kunavo sells API access and is included below. The recommendations use documented features and prices; they are not results from a comparative performance test.
Best API for OpenCode by buying need
| Candidate | Choose it for | Compare before paying |
|---|---|---|
| OpenCode Go | A $10/month allowance for selected models | Your model's short-window and monthly limits |
| OpenCode Zen | OpenCode's curated model service, billed by usage | Token rates and the 4.4% + $0.30 transaction fee |
| Direct model provider | A vendor account, its support, and its available model features | Exact model rate, account limits, and any negotiated pricing |
| OpenRouter | Choosing among models and inference providers in one service | The selected route, model price, and current credit-purchase terms |
| Kunavo | Usage billing through a custom provider with a published model catalog | The supported interface, current model rate, and complete task behavior |
| Local inference or available free models | A low incremental cash cost for suitable tasks | Hardware capacity, model quality, quotas, and availability |
Sources checked September 17, 2026: OpenCode provider documentation, Go, Zen, and OpenRouter's billing and product FAQ. For the complete Go-versus-Zen bill structure, see OpenCode pricing.
Cheapest API: compare the same model first
The table below holds the model and billed token counts constant. It compares standard uncached input/output pricing, in US dollars per million tokens. The example is 1 million input tokens plus 100,000 output tokens, before separately billed tools, cache operations, and payment fees. It shows price arithmetic, not a prediction of your repository's monthly usage.
| Model | Anthropic direct input / output | Kunavo input / output | Example direct / Kunavo |
|---|---|---|---|
| Claude Haiku 4.5 | $1 / $5 | $0.40 / $2.00 | $1.50 / $0.60 |
| Claude Sonnet 4.6 | $3 / $15 | $1.20 / $6.00 | $4.50 / $1.80 |
| Claude Sonnet 5 | $2 / $10 | $2.00 / $10.00 | $3.00 / $3.00 |
Direct prices were checked against Anthropic's standard pricing on September 17, 2026; Kunavo prices come from the same catalog as our live price list. Some models can be below direct list while others are at list. Neither a catalog-wide discount nor a claim to the world's cheapest API follows from a few rows.
The Kunavo examples estimate catalog cost. The billing calculation charges the higher of that total and upstream cost multiplied by the model's markup factor, so the final usage charge can exceed the example. If you already receive an enterprise discount or cloud credits elsewhere, compare your actual invoice rate.
Include the payment and the repeated context
Kunavo's minimum prepaid top-up is $10, with no required subscription and no balance expiry. This is the cash needed to fund the account, not the amount every task consumes. OpenRouter's minimum purchase is $5 of credits; its standard PAYG card fee is 5.5%, with a $0.80 minimum per top-up. A $5 credit purchase therefore costs $5.80 before tax. Add funding fees once, and compare credit you expect to consume with a subscription's usable allowance.
For a long OpenCode session, separate fresh input from cache reads and writes. Sonnet 4.6's direct rates are $0.30 per million cache-read tokens, $3.75 for five-minute writes, and $6 for one-hour writes. Kunavo's catalog cache-read rate for Claude Sonnet 4.6 is $0.12; Claude cache writes bill at 1.25 times input. A frequently reused prefix makes the read price important; changing models or providers may start a fresh cache instead of carrying earlier hits across.
Sonnet 4.6 and Sonnet 5 have standard pricing throughout their supported 1M context window on direct Anthropic and Kunavo. Larger context still costs more through additional tokens. For GPT or Gemini choices outside this table, check the selected model's long-context tier separately; a Claude price comparison cannot establish their large-request cost. Match these categories to the usage your selected OpenCode route actually reports.
Cheapest model and best value are different comparisons
Haiku 4.5 is the lowest-priced Claude model among the three rows above at the direct rates shown. That makes it a reasonable budget candidate for bounded work, not a proven winner on complex changes. Give a candidate the kind of task you repeat: a small test addition, a documentation update, or a bug with a known reproduction.
Then evaluate a harder task separately. A model that is inexpensive for routine edits may require repeated corrections on a multi-file refactor. Record the cost of all attempts and the time needed to accept the result. Choose a daily model and an escalation model based on those two classes of work instead of buying every task at the highest tier.
Go or a supported subscription connection can be better value when the allowance already covers that work. Usage billing can win when work is occasional or your preferred model is outside the plan. The useful unit is dollars spent on accepted work; unused allowance and unfinished patches do not count as savings.
Connect the candidate and verify the purchase
OpenCode's provider menu and custom configuration let you change model access without moving the repository to another agent. Connect the account, select the exact provider/model pair, and check whose bill will receive the next task. Keep credentials associated with their intended host rather than swapping unrelated keys into the same provider entry.
To evaluate Kunavo, follow the OpenCode setup guide. Configuration fields differ across OpenCode versions; the provider and model error guide helps identify a mismatched schema or model ID. Run one edit, confirm the tests, and inspect the usage charge. Once it meets your needs, apply the same account and model choice to the work you actually want to move.
FAQ
What is the best API for OpenCode?
Choose Go for recurring work that fits its included models and allowances, Zen for OpenCode's curated usage service, a direct provider when its account features matter, OpenRouter for its model and routing catalog, or a custom gateway when its model pricing and billing suit your workload. Kunavo is one such custom option, with published model prices and a manual configuration path.
What is the cheapest API for OpenCode?
Compare the exact model and workload. A free model or an existing supported subscription may have the lowest extra cash cost; a $10 Go plan may fit frequent work. For usage billing, compare input, output, caching, and payment fees. No one provider is always cheapest for every model.
Can OpenCode use Kunavo?
Kunavo provides a documented custom-provider setup. Use the API interface and configuration schema appropriate to your installed OpenCode version, then verify a complete edit-and-test task. This is a manual integration path, not a claim that Kunavo appears in the built-in provider directory or has been benchmarked against every option.
Should I choose the cheapest model?
Use a cheaper model when it can complete the task with acceptable review effort. Compare the total charge for accepted work, including retries, and keep a stronger model available for difficult debugging. Token price alone cannot establish which model is best value for your repository.