feat(channels): adding Anthropic messages API format support to the OpenCodeGo channel (#1751)#1791
Conversation
…penCodeGo channel Changes: - Ent schema: new 'opencode_go_anthropic' type enum - channel_llm.go: PlatformDirect transformer, separate case statement - Frontend: new channel config with actual supported models (minimax-m3/m2.7/m2.5, qwen3.7-max/plus, qwen3.6-plus) - Provider mapping: opencode_go provider now supports both OpenAI and Anthropic formats - i18n: English/Chinese display names - Generated: Ent migration schema, GraphQL enum, internal schema Also updates opencode_go channel config: - baseURL: https://opencode.ai/zen/go (removed trailing /v1, added by transformer) - defaultModels: glm-5.1, glm-5, kimi-k2.5/2.6, deepseek-v4-pro/flash, mimo-v2.5/pro
Greptile SummaryThis PR adds an
Confidence Score: 5/5Safe to merge — the change is an additive, well-scoped new channel variant following an established pattern, with no modifications to shared logic. All changes are additive: a new enum value, a new switch case, a new frontend config entry, and updated i18n. No existing behaviour is modified except the opencode_go default model list and base URL, which only affect newly created channels. The dead Provider union member flagged in review was already removed in the head commit. The backend transformer path for opencode_go_anthropic is identical in structure to the existing bailian_anthropic/moonshot_coding path and carries no new risk. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming Request] --> B{Channel Type?}
B -->|opencode_go| C[OpenAI Chat Completions Transformer]
B -->|opencode_go_anthropic| D[anthropic.PlatformDirect Transformer]
B -->|bailian_anthropic / moonshot_coding| D
C --> E[https://opencode.ai/zen/go + /v1 appended]
D --> F[https://opencode.ai/zen/go direct]
E --> G[OpenAI-compatible models: glm-5.1, kimi-k2.x, deepseek-v4-x, mimo-v2.5]
F --> H[Anthropic Messages models: minimax-m3/m2.7/m2.5, qwen3.7-max/plus, qwen3.6-plus]
Reviews (2): Last reviewed commit: "fix(channels): remove dead 'opencode_go_..." | Re-trigger Greptile |
…n type 'opencode_go_anthropic' was added to the Provider union but CHANNEL_TYPE_TO_PROVIDER maps it to 'opencode_go', so no code path ever produces a Provider value of 'opencode_go_anthropic'. Removing the dead union member while keeping ChannelType and provider mapping intact.
…penCodeGo channel (looplj#1751) (looplj#1791) * feat(channels): adding Anthropic messages API format support to the OpenCodeGo channel Changes: - Ent schema: new 'opencode_go_anthropic' type enum - channel_llm.go: PlatformDirect transformer, separate case statement - Frontend: new channel config with actual supported models (minimax-m3/m2.7/m2.5, qwen3.7-max/plus, qwen3.6-plus) - Provider mapping: opencode_go provider now supports both OpenAI and Anthropic formats - i18n: English/Chinese display names - Generated: Ent migration schema, GraphQL enum, internal schema Also updates opencode_go channel config: - baseURL: https://opencode.ai/zen/go (removed trailing /v1, added by transformer) - defaultModels: glm-5.1, glm-5, kimi-k2.5/2.6, deepseek-v4-pro/flash, mimo-v2.5/pro * fix(channels): remove dead 'opencode_go_anthropic' from Provider union type 'opencode_go_anthropic' was added to the Provider union but CHANNEL_TYPE_TO_PROVIDER maps it to 'opencode_go', so no code path ever produces a Provider value of 'opencode_go_anthropic'. Removing the dead union member while keeping ChannelType and provider mapping intact.
Description
Related Issue: #1751
Add
opencode_go_anthropicchannel type to support Anthropic Messages API format for OpenCode Go provider, and updateexisting
opencode_gochannel config with actual supported models.New Channel Type:
opencode_go_anthropicThe OpenCode Go provider now supports the Anthropic Messages API format (
@ai-sdk/anthropic) alongside the existingOpenAI-compatible format. (Note that only some models support the Anthropic Messages API
format. See https://opencode.ai/docs/zh-cn/go/#api-%E7%AB%AF%E7%82%B9)
Supported Models
Updated Channel Config:
opencode_gohttps://opencode.ai/zen/go(removed trailing/v1, added by transformer)glm-5.1,glm-5,kimi-k2.5,kimi-k2.6,deepseek-v4-pro,deepseek-v4-flash,mimo-v2.5,mimo-v2.5-proOpenAI-Compatible Models (use
opencode_gochannel)Technical Details
Backend
opencode_go_anthropicenum value ininternal/ent/schema/channel.goanthropic.PlatformDirecttransformer, followingbailian_anthropicpatternFrontend
opencode_goconfigopencode_goprovider now lists both channel typesOpenCode Go (Anthropic)in English and ChineseFiles Changed
internal/ent/schema/channel.gointernal/ent/channel/channel.gointernal/server/biz/channel_llm.gointernal/server/gql/ent.graphqlinternal/ent/internal/schema.gointernal/ent/migrate/schema.gofrontend/src/features/channels/data/config_channels.tsfrontend/src/features/channels/data/config_providers.tsfrontend/src/features/channels/data/schema.tsfrontend/src/locales/en/channels.jsonfrontend/src/locales/zh-CN/channels.jsonTesting
Verified against live OpenCode Go API with PostgresSQL backend:
qwen3.5-plus): Correctly returns thinking + tool_use blocksqwen3.5-plus): Complete SSE events (message_start → content_block_start thinking →content_block_delta → tool_use → message_stop)
qwen3.5-plus,qwen3.6-plus,minimax-m3all work correctlyNotes
deepseek-v4-flash) are routed to DeepSeek backend by OpenCode Go gateway, which expects OpenAItool format. These should use
opencode_gochannel type instead.opencode_go_anthropicchannel type is intended for models that natively support Anthropic Messages API format.