fix(models): classify Responses and Gemini endpoints by prefix - #153
Merged
samueltuyizere merged 2 commits intoAug 25, 2026
Merged
Conversation
The Zen classifier hard-coded individual model IDs for the Responses and Gemini endpoints, so newer models (grok-*, muse-spark-*, gemini-3.7-flash, gemini-3.6-flash, gemini-3.5-flash-lite, gpt-5.6-*) fell through to the default Chat Completions endpoint and the proxy could not route them. Switch IsResponsesModel and IsGeminiModel to prefix matching so all current and future models in each family route to the correct endpoint. Correct the grok-build-0.1 test expectation (it uses the Responses endpoint) and fix the howto-add-model.md claim that adding a model requires zero code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Zen endpoint classifier in
internal/models/classifier.gohard-coded individual model IDs for the Responses and Gemini endpoints. Newer models that fall in those families were not listed, so they fell through to the default Chat Completions endpoint and the proxy could not route them correctly.The OpenCode Zen docs categorize models by endpoint:
/v1/responses):gpt-*,grok-*,muse-spark-*/v1/models/{id}):gemini-*/v1/messages):claude-*,qwen*Changes
internal/models/classifier.go—IsResponsesModelandIsGeminiModelnow use prefix matching instead of hard-coded ID lists, covering all current and future models in each family (addsgrok-*,muse-spark-*,gemini-3.7-flash,gemini-3.6-flash,gemini-3.5-flash-lite,gpt-5.6-*).internal/client/opencode_test.go— correctedgrok-build-0.1(it uses the Responses endpoint, not Chat Completions) and added coverage for the newly covered model families.docs/howto-add-model.md— corrected the claim that adding a model requires zero code changes.Scope note
This change is Zen-only. The Go provider is intentionally config-driven (
wire_formatoverride, see #141) and is not touched here.Validation
make test— all 17 packages pass (race detector)make lint— gofmt + vet cleanmake lint-strict— golangci-lint: 0 issuesdeepseek-v4-flashrequest returns HTTP 200; the classifier changes verified by unit tests🤖 Generated with Claude Code