From 2fc77c53f0e836f9c56161908ddd0be7a5466c73 Mon Sep 17 00:00:00 2001 From: beardthelion Date: Tue, 26 May 2026 14:23:40 -0500 Subject: [PATCH] feat(opencode-go): route qwen3.7-max via anthropic_messages qwen3.7-max on OpenCode Go rejects the OpenAI-compatible (oa-compat) format with HTTP 401 but works correctly via the Anthropic Messages endpoint (/v1/messages with x-api-key auth). Route it the same way MiniMax models are routed: anthropic_messages api_mode. Changes: - hermes_cli/models.py: add qwen3.7-max routing + curated list - hermes_cli/setup.py: add to setup wizard model list - hermes_cli/auth.py: update provider comment - tests: add assertions for qwen3.7-max api_mode routing --- hermes_cli/auth.py | 1 + hermes_cli/models.py | 3 +++ hermes_cli/setup.py | 2 +- tests/hermes_cli/test_model_validation.py | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py index 6f4fc344636..1cffe272868 100644 --- a/hermes_cli/auth.py +++ b/hermes_cli/auth.py @@ -402,6 +402,7 @@ PROVIDER_REGISTRY: Dict[str, ProviderConfig] = { # OpenCode Go mixes API surfaces by model: # - GLM / Kimi use OpenAI-compatible chat completions under /v1 # - MiniMax models use Anthropic Messages under /v1/messages + # - Qwen 3.7 uses Anthropic Messages under /v1/messages # Keep the provider base at /v1 and select api_mode per-model. inference_base_url="https://opencode.ai/zen/go/v1", api_key_env_vars=("OPENCODE_GO_API_KEY",), diff --git a/hermes_cli/models.py b/hermes_cli/models.py index 8af3951ecc0..354045ed5df 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -399,6 +399,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = { "mimo-v2-omni", "minimax-m2.7", "minimax-m2.5", + "qwen3.7-max", "qwen3.6-plus", "qwen3.5-plus", ], @@ -3015,6 +3016,8 @@ def opencode_model_api_mode(provider_id: Optional[str], model_id: Optional[str]) if provider == "opencode-go": if normalized.startswith("minimax-"): return "anthropic_messages" + if normalized.startswith("qwen3.7-max"): + return "anthropic_messages" return "chat_completions" if provider == "opencode-zen": diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py index 350b2501c9c..1af23f3b9cd 100644 --- a/hermes_cli/setup.py +++ b/hermes_cli/setup.py @@ -104,7 +104,7 @@ _DEFAULT_PROVIDER_MODELS = { "ai-gateway": ["anthropic/claude-opus-4.6", "anthropic/claude-sonnet-4.6", "openai/gpt-5", "google/gemini-3-flash"], "kilocode": ["anthropic/claude-opus-4.6", "anthropic/claude-sonnet-4.6", "openai/gpt-5.4", "google/gemini-3-pro-preview", "google/gemini-3-flash-preview"], "opencode-zen": ["gpt-5.4", "gpt-5.3-codex", "claude-sonnet-4-6", "gemini-3-flash", "glm-5", "kimi-k2.5", "minimax-m2.7"], - "opencode-go": ["kimi-k2.6", "kimi-k2.5", "glm-5.1", "glm-5", "mimo-v2.5-pro", "mimo-v2.5", "mimo-v2-pro", "mimo-v2-omni", "minimax-m2.7", "minimax-m2.5", "qwen3.6-plus", "qwen3.5-plus"], + "opencode-go": ["kimi-k2.6", "kimi-k2.5", "glm-5.1", "glm-5", "mimo-v2.5-pro", "mimo-v2.5", "mimo-v2-pro", "mimo-v2-omni", "minimax-m2.7", "minimax-m2.5", "qwen3.7-max", "qwen3.6-plus", "qwen3.5-plus"], "huggingface": [ "Qwen/Qwen3.5-397B-A17B", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-Coder-480B-A35B-Instruct", "deepseek-ai/DeepSeek-R1-0528", diff --git a/tests/hermes_cli/test_model_validation.py b/tests/hermes_cli/test_model_validation.py index 03c0fcca3d4..91fc4e50d00 100644 --- a/tests/hermes_cli/test_model_validation.py +++ b/tests/hermes_cli/test_model_validation.py @@ -414,6 +414,8 @@ class TestCopilotNormalization: assert opencode_model_api_mode("opencode-go", "opencode-go/kimi-k2.5") == "chat_completions" assert opencode_model_api_mode("opencode-go", "minimax-m2.5") == "anthropic_messages" assert opencode_model_api_mode("opencode-go", "opencode-go/minimax-m2.5") == "anthropic_messages" + assert opencode_model_api_mode("opencode-go", "qwen3.7-max") == "anthropic_messages" + assert opencode_model_api_mode("opencode-go", "opencode-go/qwen3.7-max") == "anthropic_messages" class TestAzureFoundryModelApiMode: