← The general playbook

Cut OpenCode's API Costs

OpenCode's costs concentrate in session length: LSP-enriched context and conversation history ride on every step, so late-session calls cost several times early ones. Compacting sessions, resetting per task, and routing routine steps to a cheaper model are the big three levers.

Where OpenCode's money actually goes

·LSP integration enriches prompts with real code intelligence — valuable, and token-heavy on large files.
·Resumable sessions encourage long-lived context that grows with every tool result.
·Multi-provider freedom means the cost ceiling is whatever model you picked — often a frontier default.

The OpenCode-specific tactics

01

Compact aggressively, reset per task

Session length is the cost multiplier: every appended step re-bills on the next call. Use compaction between work phases and fresh sessions per distinct task.

02

Split model by task weight

OpenCode switches providers per session trivially — run a value model (DeepSeek/Kimi-class) as the default and reserve the frontier model for sessions that need it.

03

Point it at a flat-rate endpoint for daily driving

OpenCode is many people's all-day driver, which is exactly the usage shape where per-token loses. One base-URL swap makes the whole workflow unmetered.

The provider-agnostic tactics (prompt caching, retry budgets, batch APIs) are in the general playbook.

OpenCode costs — common questions

Why do my OpenCode sessions get more expensive as they go?

Context accumulates: every tool result and message is resent with each new step, so a step late in a long session can cost several times an early one. Compaction and per-task resets flatten that curve.

What's the cheapest way to run OpenCode?

For light use: an open-weight value model per-token (DeepSeek V4-class). For all-day use: a flat-rate unlimited endpoint — OpenCode's OpenAI-compatible provider support makes it a two-minute switch.

The structural version of all of this: run OpenCode on a flat monthly price with unlimited tokens, and the bill stops being a variable to manage. 2-minute OpenCode setup → · Best models for OpenCode