Repository navigation
fix(llm): per-model protocol bindings for OpenCode Zen/Go presets - #394
Merged
Merged
Conversation
The presets mapped both OpenCode gateways to LLMProvider.Anthropic with a single AnthropicMessages binding, but neither gateway is Anthropic-only: - Go serves /responses (grok-4.6, gpt-5.6-luna) and /chat/completions - Zen is per-model: claude-* -> messages, gpt-*/grok-* -> responses, gemini-* -> Google, everything else -> chat completions - LlmProviderPreset gains optional Bindings + ModelBindingRules (prefix -> binding) and CatalogIsEntitlement to mark subscription gateways - preset creation builds the extra bindings and assigns seeded models to the protocol matched by their name; Zen stays pay-per-token (no auto-seeded models) - Go seeds the official model list and refreshes its catalog add-only from /models, assigning discovered models through the same rules - AnthropicMessagesTransport applies x-opencode-session (per-chat when known), fixing Go's 400 MissingSessionID on the Anthropic-compatible path - IEditLLMConfHelper: EnsureBinding + AssignModelBinding helpers - Tests: LlmProviderCatalogTests, AnthropicTransportSessionTests, preset flow
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
PR Check ReportSummary
Test Results
Code Quality
Test Artifacts
LinksThis report is auto-generated by GitHub Actions |
This was referenced Sep 16, 2026
ModerRAS
added a commit
that referenced
this pull request
Sep 17, 2026
Resolve #395 conflicts after #393/#394 were squash-merged: - LlmProviderCatalog / IEditLLMConfHelper / EditLLMConfHelper / EditLLMConfTest: keep the branch side (step 2 + step 3/4 content is the superset) - GeneralBootstrap: keep master's startup catalog refresh (#393) and re-add the providers.json source log from step 3 Validated after merge: build 0 errors; LLM.Test 310/310; main tests 455 passed / 1 skipped
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.
Why
opencode-zen/opencode-gopresets mapped both gateways toLLMProvider.Anthropicwith oneAnthropicMessagesbinding. Neither gateway is Anthropic-only:https://opencode.ai/zen/go/v1) serves/responses(grok-4.6, gpt-5.6-luna) and/chat/completions(glm/kimi/deepseek/longcat/minimax/qwen/mimo) — no Anthropic endpoint at allhttps://opencode.ai/zen/v1) is per-model:claude-*→ messages,gpt-*/grok-*→ responses,gemini-*→ Google, everything else → chat completionsAs written, a Go preset channel sent Anthropic wire format to an OpenAI-only gateway, and even the Anthropic-compatible path was missing
x-opencode-session(the 400 MissingSessionID that #389 fixed for the OpenAI paths).What
LlmProviderPresetgains optionalBindings+ModelBindingRules(prefix → binding) andCatalogIsEntitlement(subscription gateways whose catalog is the entitlement).EnsureBinding) and assigns each seeded model to the protocol matched by its name (AssignModelBinding). Zen stays pay-per-token: no auto-seeded models, manual rows untouched./modelsadd-only (no soft-deletes), binding discovered models through the same rules.AnthropicMessagesTransportnow appliesx-opencode-session(per-chat when known, otherwise the global session) — Go's Anthropic-compatible requests no longer fail.IEditLLMConfHelper:EnsureBinding,AssignModelBinding.Validation
dotnet build TelegramSearchBot.sln -c Release→ 0 errorsTelegramSearchBot.LLM.Test→ 294/294 (new:LlmProviderCatalogTests,AnthropicTransportSessionTests)TelegramSearchBot.Test→ 446 passed, 1 skipped (new preset flow test)Notes