Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/opencode/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ _: {
force = true;
};

home.file.".config/opencode/opencode-fallback.jsonc" = {
source = ./opencode-fallback.jsonc;
force = true;
};

home.file.".config/opencode/tui.json" = {
source = ./tui.json;
force = true;
Expand Down
15 changes: 15 additions & 0 deletions config/opencode/opencode-fallback.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"enabled": true,
"retry_on_errors": [401, 404, 429, 500, 502, 503, 504],
"max_fallback_attempts": 5,
"cooldown_seconds": 60,
"timeout_seconds": 30,
"notify_on_fallback": true,
"fallback_models": [
"shunkakinoki/deepseek-v4-pro",
"shunkakinoki/gemma-4-31b-it",
"shunkakinoki/glm-4.7",
"shunkakinoki/minimax-m3",
"shunkakinoki/free"
]
}
15 changes: 15 additions & 0 deletions config/opencode/opencode-fallback.tpl.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"enabled": true,
"retry_on_errors": [401, 404, 429, 500, 502, 503, 504],
"max_fallback_attempts": 5,
"cooldown_seconds": 60,
"timeout_seconds": 30,
"notify_on_fallback": true,
"fallback_models": [
"shunkakinoki/__DEEPSEEK_PRO__",
"shunkakinoki/__GEMMA__",
"shunkakinoki/__GLM__",
"shunkakinoki/__MINIMAX__",
"shunkakinoki/free"
]
}
22 changes: 21 additions & 1 deletion config/opencode/opencode.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,26 @@
"deepseek-v4-flash": {
"name": "Deepseek V4 Flash (via shunkakinoki's CLIProxy)"
},
"deepseek-v4-pro": {
"name": "Deepseek V4 Pro (via shunkakinoki's CLIProxy)"
},
"gemma-4-31b-it": {
"name": "Gemma 4 31b It (via shunkakinoki's CLIProxy)"
},
"z-ai/glm-4.7": {
"name": "GLM 4.7 (via shunkakinoki's CLIProxy)"
},
"glm-4.7": {
"name": "GLM 4.7 with provider fallback (via shunkakinoki's CLIProxy)"
},
"minimax-m3": {
"name": "Minimax M3 (via shunkakinoki's CLIProxy)"
},
"kimi-k3": {
"name": "Kimi K3 (via shunkakinoki's CLIProxy)"
},
"free": {
"name": "Free router fallback (via shunkakinoki's CLIProxy)"
}
}
},
Expand Down Expand Up @@ -224,5 +239,10 @@
}
}
},
"plugin": ["cc-safety-net", "opencode-atuin-history", "opencode-claude-hooks"]
"plugin": [
"cc-safety-net",
"opencode-atuin-history",
"opencode-claude-hooks",
"opencode-runtime-fallback@0.2.3"
]
}
22 changes: 21 additions & 1 deletion config/opencode/opencode.tpl.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,26 @@
"__DEEPSEEK_FLASH__": {
"name": "__DEEPSEEK_FLASH_PRETTY__ (via shunkakinoki's CLIProxy)"
},
"__DEEPSEEK_PRO__": {
"name": "__DEEPSEEK_PRO_PRETTY__ (via shunkakinoki's CLIProxy)"
},
"__GEMMA__": {
"name": "__GEMMA_PRETTY__ (via shunkakinoki's CLIProxy)"
},
"z-ai/__GLM__": {
"name": "__GLM_PRETTY__ (via shunkakinoki's CLIProxy)"
},
"__GLM__": {
"name": "__GLM_PRETTY__ with provider fallback (via shunkakinoki's CLIProxy)"
},
"__MINIMAX__": {
"name": "__MINIMAX_PRETTY__ (via shunkakinoki's CLIProxy)"
},
"__KIMI__": {
"name": "__KIMI_PRETTY__ (via shunkakinoki's CLIProxy)"
},
"free": {
"name": "Free router fallback (via shunkakinoki's CLIProxy)"
}
}
},
Expand Down Expand Up @@ -224,5 +239,10 @@
}
}
},
"plugin": ["cc-safety-net", "opencode-atuin-history", "opencode-claude-hooks"]
"plugin": [
"cc-safety-net",
"opencode-atuin-history",
"opencode-claude-hooks",
"opencode-runtime-fallback@0.2.3"
]
}
1 change: 1 addition & 0 deletions scripts/llm-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ declare -A TEMPLATES=(
["config/llm/default_model.tpl.txt"]=config/llm/default_model.txt
["config/openclaw/openclaw.tpl.json"]=config/openclaw/openclaw.template.json
["config/opencode/opencode.tpl.jsonc"]=config/opencode/opencode.jsonc
["config/opencode/opencode-fallback.tpl.jsonc"]=config/opencode/opencode-fallback.jsonc
["config/llm/extra-openai-models.tpl.yaml"]=config/llm/extra-openai-models.yaml
["config/ccs/agy.settings.tpl.json"]=config/ccs/agy.settings.template.json
["config/ccs/codex.settings.tpl.json"]=config/ccs/codex.settings.template.json
Expand Down
24 changes: 22 additions & 2 deletions spec/llm_update_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,27 @@ The status should be success
End
End

Describe 'DeepSeek defaults'
It 'generates the remote CLIProxyAPI DeepSeek Flash default'
Describe 'OpenCode runtime fallback'
It 'keeps DeepSeek Flash as the explicit default model'
When run bash -c "grep '\"model\": \"shunkakinoki/deepseek-v4-flash\"' config/opencode/opencode.jsonc"
The output should include 'shunkakinoki/deepseek-v4-flash'
End

It 'keeps the explicitly pinned Z-AI small model'
When run bash -c "grep '\"small_model\": \"shunkakinoki/z-ai/glm-4.7\"' config/opencode/opencode.jsonc"
The output should include 'shunkakinoki/z-ai/glm-4.7'
End

It 'pins the audited OpenCode runtime fallback plugin release'
When run bash -c "grep -q '\"opencode-runtime-fallback@0.2.3\"' config/opencode/opencode.jsonc"
The status should be success
End

It 'generates a separate OpenCode fallback chain'
When run bash -c "jq -e '.retry_on_errors == [401,404,429,500,502,503,504] and .max_fallback_attempts == 5 and .fallback_models == [\"shunkakinoki/deepseek-v4-pro\",\"shunkakinoki/gemma-4-31b-it\",\"shunkakinoki/glm-4.7\",\"shunkakinoki/minimax-m3\",\"shunkakinoki/free\"]' config/opencode/opencode-fallback.jsonc >/dev/null"
The status should be success
End

It 'generates the CLIProxyAPI DeepSeek models'
When run bash -c "sed -n '/\"cliproxyapi\"/,/\"lmstudio\"/p' config/opencode/opencode.jsonc | grep -q 'deepseek-v4-flash' && sed -n '/\"cliproxyapi\"/,/\"lmstudio\"/p' config/opencode/opencode.jsonc | grep -q 'deepseek-v4-pro'"
The status should be success
Expand Down Expand Up @@ -143,6 +158,11 @@ When run bash -c "section=\$(sed -n '/name: \"openrouter\"/,/name: \"z-ai\"/p' c
The status should be success
End

It 'does not expose a main alias through OpenCode or CLIProxy'
When run bash -c "! grep -q '\"main\": {' config/opencode/opencode.jsonc && ! grep -q 'alias: \"main\"' config/cliproxyapi/config.template.yaml"
The status should be success
End

It 'hydrates the versioned Aliyun DeepSeek model behind the canonical alias'
When run bash -c "section=\$(sed -n '/name: \"aliyun\"/,/name: \"opencode\"/p' config/cliproxyapi/config.template.yaml); printf '%s\n' \"\$section\" | grep -q 'name: \"deepseek-v4-flash-0731\"' && printf '%s\n' \"\$section\" | grep -q 'alias: \"deepseek-v4-flash\"'"
The status should be success
Expand Down
Loading