Quick answer
Codex is usually a subscription with short and weekly windows; OpenCode is a client whose cost follows the provider you connect. For a like-for-like comparison, run the same task with the same model through OpenCode's API provider and through Codex API billing, then compare tokens per completed task.
The structural difference
| OpenCode | Codex | |
|---|---|---|
| Billing | Whatever provider you connect | Plan windows or API billing |
| Limits | Provider rate limits | 5-hour and weekly windows |
| Models | Many providers | OpenAI models |
| History | Local database | Local JSONL sessions |
| Cost visibility | Per message | Per session |
Make it comparable
- Choose an OpenAI model available in both.
- Use API billing in both so rates match.
- Run the same task in a fresh session.
- Record tokens and turns.
- Compare cost per completed task.
If you compare OpenCode on a cheap third-party model with Codex on a plan, you are comparing two different products and the result will not generalise.
How to choose
- Pick Codex if you want one plan and are happy with OpenAI models.
- Pick OpenCode if you need provider flexibility or local model access.
- Pick both if one covers overflow for the other.
- Whichever you pick, track tokens per task rather than price per token.
OpenCode and Codex compared
| Dimension | OpenCode | Codex |
|---|---|---|
| Billing | Provider keys | ChatGPT plan or API |
| Metering | Tokens per provider | Tokens plus plan windows |
| Local data | SQLite database | JSONL session files |
| Aggregation | Bring your own tracker | CLI status plus account panel |
| Best for | Multi-model freedom | One allowance, less setup |
The practical difference for budgets is who enforces the limit. With OpenCode, the limit belongs to the provider key you configured, so two keys mean two separate quotas. Codex enforces a plan window for you.
UsageAtlas tracks both, which makes cost per task comparable.
Questions, answered
Is OpenCode free?
The client is open source. The models you connect are not, unless you use a free provider or local model.
Does OpenCode have usage windows?
Not of its own. Any window comes from the provider you connect.
Which is better for long agent runs?
The one whose limit you can predict. Codex publishes two windows; OpenCode's limits are whatever the provider enforces.