Open-source agent with a cheap model, paid per token
Developers who prefer open source and want to pay only for what they use.
| Cost | Pay as you go: about $0.20-1.72 for an example task (1M input + 100K output tokens) with the models below |
|---|
What is in it
| Role | Part | Why |
|---|---|---|
| Coding agent | OpenCode OpenCode is free and open source with free models included and support for any... |
Open source, works with any provider and model. |
| Everyday model | GLM-5.3 Flash $0.15 / $0.5 per 1M tokens |
Fast and very cheap for edits and small tasks. |
| Harder tasks | DeepSeek V4 Pro $1.32 / $3.96 per 1M tokens |
Switch to it for planning and tricky bugs. |
| Library docs | Context7 Free for individuals with 1,000 API calls a month. Pro is $10 per seat a month with... |
Up-to-date docs through MCP. |
Set it up
npm install -g opencode-ai- Connect a provider in OpenCode (an API key from Z.ai, DeepSeek or OpenRouter) and pick the model per session.
- Set OpenCode permissions to ask for shell commands: it runs freely by default.
Trade-offs
You manage API keys and spending yourself, and open models need more steering on large refactors. OpenCode has no sandbox, so keep command approvals on.
Comments
- Using this stack? Share what worked and what did not.
Other stacks
Claude Code on a $20 plan, without hitting the limit Plan with a frontier model, code with a fast one A coding agent with guardrails for a team