Skip to content

Commit c75c9fb

Browse files
committed
Fix: variant field causes 'Invalid API parameter' on GLM provider
The variant:high/variant:max fields injected by the installer are provider-specific. The ZAI/GLM-5.2 provider does not support the OpenCode variant parameter — every subagent spawn fails with 'Invalid API parameter, please check the documentation.' Root cause: OpenCode passes the agent's variant field to the provider as a model option. Providers that don't recognize the variant name reject the entire API call. The main build agent works because its model comes from opencode.json (no variant). Only subagents with variant: in their frontmatter fail. Fix: - Stripped variant from all 49 agents in ocg-test and stillcurrent - Added warning in install.sh when --variant-* flags are provided - Documented in lib/models.sh that variant is provider-specific The model field (zai-coding-plan/glm-5.2) is retained on all agents — only the variant is removed. Users whose provider supports variants can add them manually to agent frontmatter.
1 parent 9e8d16a commit c75c9fb

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

.opencode/install.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ fi
133133
# ── Validate models ──────────────────────────────────────────────
134134
printf '\n── Validating models ──────────────────────────────────────\n'
135135

136+
# Warn about variants if provided
137+
if [ -n "$opus_variant$sonnet_variant$haiku_variant" ]; then
138+
printf ' ⚠ Variants are provider-specific. If your provider does not support\n' >&2
139+
printf ' the variant parameter, subagent tasks will fail with "Invalid API\n' >&2
140+
printf ' parameter". If this happens, re-run without --variant-* flags.\n\n' >&2
141+
fi
142+
136143
validation_failed=0
137144
for tier in opus sonnet haiku; do
138145
eval "model=\"\${${tier}_model:-}\""

.opencode/lib/models.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ else:
6060
" 2>/dev/null
6161
}
6262

63-
# Inject or replace model: and variant: in an agent file's frontmatter
63+
# Inject or replace model: in an agent file's frontmatter
6464
# Usage: ccgs_inject_model <agent_file> <model_id> [variant]
65+
# Note: variant is provider-specific and may cause "Invalid API parameter"
66+
# errors if the provider doesn't support it. Leave empty to omit.
6567
ccgs_inject_model() {
6668
local file="$1" model_id="$2" variant="${3:-}"
6769
python3 -c "

0 commit comments

Comments
 (0)