Move your default coding agent to OpenCode via OpenRouter

DeepSeek V4.1 Flash passed every run of his two-task test at about two cents a task (self-reported, "a field report and not a ranking").

by Joe KarlssonOct 2026

Prompt for your agent

Goal: Move your default coding agent to OpenCode with open-weight models
Setup: agents used in source: OpenCode, Claude.
Before you start: An OpenRouter account (a LiteLLM gateway is optional).
Steps:
1. Point OpenCode at OpenRouter (gateway optional): The author routes everything through LiteLLM with names like cloud-coder, fallbacks and per-app budgets.
2. Run your own two-task bake-off: One easy and one hard task with hidden tests; two runs per model; grade pass/fail, time and cost.
3. Pick the cheapest model that passes: For him: DeepSeek V4.1 Flash as default.
4. Make OpenCode send reasoning back: Set `interleaved: {field: "reasoning_content"}` and a reasoningEffort per model in opencode.json.
5. Add a "Done means verified" rule to global AGENTS.md: Run the change, paste 1–5 proof lines, end PASS or FAIL.
6. Add a verify gate if the model still skips it: A ~100-line OpenCode plugin sends the agent back once if it edited code and ran nothing.
7. Keep Claude as the escalation path: Harder coding to DeepSeek V4 Pro; the hardest problems to Claude.
Rules: ask me before anything irreversible (sending, posting, paying, deleting); don’t invent data, results or tools I haven’t given you; tell me what you couldn’t verify.
Based on: Joe Karlsson — https://www.joekarlsson.com/blog/breaking-up-with-claude-code/ (summarised from source; the source has no explicit step list)

Steps are our summary of the source (it has no explicit step list). Includes a “Based on” credit line.

I tried this

Tell the next builder. One anonymous answer each; click again to undo.

Agents, models and tools only what the source states

Agents
OpenCode Claude
Models
DeepSeek V4.1 Flash Claude (escalation for the hardest problems)
Cost
About two cents a task on DeepSeek V4.1 Flash; OpenCode capped at $20 a month at his gateway

Sources & credit