Typing limit as the key clears the input automatically - OpenCode
Quick fix
The cc-switch UI treats limit as a reserved word, so edit opencode.json directly to set the model context and output limits by hand.
Symptom
Section titled “Symptom”当key输入为limit时,输入框内容会被自动清空,且界面没有给出明确错误提示Typing limit as the key clears the input automatically, with no clear error shown in the interface
When editing an OpenCode provider in cc-switch, opencodeFormUtils.ts lists limit among the reserved keys and OpenCodeFormFields.tsx returns immediately on encountering limit, so the GUI does not let you save it as a model property key. Some users also see a "failed to read OpenCode runtime models, showing only configured provider models" dialog while editing a provider, which usually also comes from a malformed underlying model config failing to parse.
OpenCode 1.4.0 tightened validation of the maxOutputTokens field, so a custom model without limit configured (containing context and output) errors. Since cc-switch cannot configure that field in the GUI today, the only way through is editing the config file directly.
Close cc-switch and OpenCode so the config is not overwritten.
Find and open the OpenCode config file opencode.json.
Add a limit property under the matching model config and set the context and output values.
// opencode.json"models": {"gpt-5.4": {"name": "GPT-5.4","limit": {"context": 256000,"output": 64000}}}
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- Why does a model need limit configured?
- OpenCode 1.4.0 tightened validation of the maxOutputTokens field, so a custom model with no context and output limits (the limit field) errors at runtime.
- Why does cc-switch not allow setting limit today?
- Because the cc-switch source lists limit as a reserved key, so the interface intercepts and clears it. The only way around it today is editing the JSON config file directly.
- Why does the OpenCode version shown in the interface not match the real one?
- That is expected. The cc-switch local environment check reads the OpenCode CLI version, not the OpenCode Desktop application version.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.