How opencode-go and the official DeepSeek API were wired into a single failover pool on this Mac Mini so long-running goals never stall when the opencode-go quota runs out.
What we were actually solving.
DeepSeek V4 Pro runs would start fine and then stop partway through. The root cause was not a
crash: the deepseek-v4-pro model was served only by
opencode-go. Our opencode-go subscription has a usage limit, so when a goal exhausted
that quota mid-run, there was nothing to fall back to and the work halted.
The fix: let the official DeepSeek API also serve the same
deepseek-v4-pro id, so the proxy can automatically spill over to it when opencode-go is
quota- or cooldown-blocked. Same model name in, uninterrupted work out.
One model id, two providers, priority-ordered failover.
Because both providers publish the same model id, the router treats them as one pool.
fill-first drains opencode-go (priority 9) first, then automatically routes to the
official DeepSeek API (priority 5) when opencode-go can't serve the request.
All edits live in /Users/adeel/.cli-proxy-api/config.yaml.
A backup of the original was saved alongside it as
config.yaml.bak.deepseek-opencode-primary-fallback.20260709042903.
routing.strategy: fill-first so the router prefers the highest-priority
ready provider and only spills over when it is blocked.opencode-go and official Deepseek both publish the shared id
deepseek-v4-pro — this is what forms the single failover pool.deepseek-v4-pro-oc (opencode-go) and deepseek-v4-pro-official
(official).routing:
strategy: fill-first
- name: Deepseek
base-url: https://api.deepseek.com
api-key-entries:
- api-key: sk-b...e102 # official DeepSeek key
models:
- name: deepseek-v4-pro
alias: '' # shared id: deepseek-v4-pro
- name: deepseek-v4-pro
alias: deepseek-v4-pro-official # direct-pin for testing
priority: 5 # fallback tier
- name: opencode-go
base-url: https://opencode.ai/zen/go/v1
api-key-entries:
- api-key: sk-K...z7un # opencode-go key
models:
- name: deepseek-v4-pro
alias: deepseek-v4-pro # shared id: deepseek-v4-pro
- name: deepseek-v4-pro
alias: deepseek-v4-pro-oc # direct-pin for testing
priority: 9 # preferred tier
| Model id | Served by | Role |
|---|---|---|
deepseek-v4-pro | opencode-go | Shared id · preferred |
deepseek-v4-pro-official | Deepseek | Direct-pin fallback |
deepseek-v4-pro-oc | opencode-go | Direct-pin preferred |
The commands used to edit, validate, restart, and verify.
sed -n '1,120p' /Users/adeel/.cli-proxy-api/config.yaml
ruby -ryaml -e 'YAML.load_file(ARGV.fetch(0)); puts "yaml_ok"' \
/Users/adeel/.cli-proxy-api/config.yaml
launchctl kickstart -k user/$(id -u)/com.cliproxyapi
launchctl print user/$(id -u)/com.cliproxyapi \
| rg 'state =|pid =|runs =|last exit code'
curl -sS -H 'Authorization: Bearer sk-cliproxy-local' \
http://127.0.0.1:8317/v1/models \
| ruby -rjson -e 'd=JSON.parse(STDIN.read)["data"];
puts d.select{|m| m["id"]=~/deepseek/i}.sort_by{|m| m["id"]}
.map{|m| "#{m["id"]}=#{m["owned_by"]}"}'
rg -n "deepseek-v4-pro" /Users/adeel/.cli-proxy-api/logs/stdout.log | tail -80