-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Description
Description
Bug Description
Models marked as "deprecated" in models.dev cache cannot be restored via whitelist configuration, because the deletion logic removes deprecated models BEFORE checking the whitelist.
This makes it impossible to use certain free models like kimi-k2.5-free, glm-5-free, and glm-4.7-free that are intentionally marked as deprecated but are still available and functional.
Plugins
oh-my-opencode
OpenCode version
1.2.15
Steps to reproduce
- Attempt to configure a deprecated model via
whitelistin~/.config/opencode/opencode.jsonc:
"opencode": {
"npm": "@ai-sdk/openai-compatible",
"name": "Opencode Zen",
"whitelist": [
"kimi-k2.5-free",
"glm-5-free",
"glm-4.7-free"
],
"options": {
"apiKey": "...",
"baseURL": "https://opencode.ai/zen/v1"
}
}-
Run
opencode models opencode -
Observe that the whitelisted deprecated models do NOT appear in the list
-
Only non-deprecated models show up (like
big-pickle,gpt-5-nano)
Current Behavior
Despite being in the whitelist, deprecated models are filtered out and not available for use.
Actual output:
opencode/big-pickle
opencode/gpt-5-nano
Expected output: Should include all whitelisted models including deprecated ones:
opencode/big-pickle
opencode/gpt-5-nano
opencode/kimi-k2.5-free
opencode/glm-5-free
opencode/glm-4.7-free
Root Cause
In packages/opencode/src/provider/provider.ts, the model deletion logic executes in this order (lines 996-1006):
// 1. Delete specific model IDs
if (modelID === "gpt-5-chat-latest" || ...)
delete provider.models[modelID]
// 2. Delete alpha models
if (model.status === "alpha" && !Flag.OPENCODE_ENABLE_EXPERIMENTAL_MODELS)
delete provider.models[modelID]
// 3. Delete deprecated models ⚠️ (LINE 1001 - Executes BEFORE whitelist check!)
if (model.status === "deprecated")
delete provider.models[modelID]
// 4. Check whitelist/blacklist (But models are already deleted!)
if (configProvider?.blacklist && configProvider.blacklist.includes(modelID) ||
configProvider?.whitelist && !configProvider.whitelist.includes(modelID))
delete provider.models[modelID]The issue: Deprecated models are deleted at line 1001, while the whitelist check happens at line 1002-1006. This means whitelisted deprecated models are removed before the whitelist has a chance to preserve them.
Expected Behavior
Whitelist configuration should allow users to explicitly opt-in to use models marked as deprecated, overriding the automatic deletion.
The whitelist check should be performed BEFORE the deprecated model deletion, or the deprecated deletion logic should respect the whitelist.
Additional Context
-
Affected models (all have
status: "deprecated"in models.dev cache but are still functional):opencode/kimi-k2.5-freeopencode/glm-5-freeopencode/glm-4.7-freeopencode/grok-code(not tested)opencode/qwen3-coder(not tested)
-
These free deprecated models are useful for testing and simple tasks
-
If a model is in
whitelist, it should be preserved regardless of its deprecated status
Proposed Fix
Move the whitelist/blacklist check to happen BEFORE the deprecated model deletion:
// Proposed order:
// 1. Check whitelist/blacklist FIRST
if (
(configProvider?.blacklist && configProvider.blacklist.includes(modelID)) ||
(configProvider?.whitelist && !configProvider.whitelist.includes(modelID))
) {
delete provider.models[modelID]
continue // Skip further checks for this model
}
// 2. Only delete deprecated if NOT in whitelist
if (model.status === "deprecated") delete provider.models[modelID]This way, models explicitly listed in whitelist can bypass the deprecated deletion.
Screenshot and/or share link
No response
Operating System
macOS 26.03
Terminal
iTerm2