Skip to content

feat(channels): adding Anthropic messages API format support to the OpenCodeGo channel (#1751)#1791

Merged
looplj merged 2 commits into
looplj:unstablefrom
MoshiCoCo:unstable
Jun 7, 2026
Merged

feat(channels): adding Anthropic messages API format support to the OpenCodeGo channel (#1751)#1791
looplj merged 2 commits into
looplj:unstablefrom
MoshiCoCo:unstable

Conversation

@MoshiCoCo

Copy link
Copy Markdown
Contributor

Description

Related Issue: #1751

Add opencode_go_anthropic channel type to support Anthropic Messages API format for OpenCode Go provider, and update
existing opencode_go channel config with actual supported models.

New Channel Type: opencode_go_anthropic

The OpenCode Go provider now supports the Anthropic Messages API format (@ai-sdk/anthropic) alongside the existing
OpenAI-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

Model API Format
minimax-m3 Anthropic Messages
minimax-m2.7 Anthropic Messages
minimax-m2.5 Anthropic Messages
qwen3.7-max Anthropic Messages
qwen3.7-plus Anthropic Messages
qwen3.6-plus Anthropic Messages

Updated Channel Config: opencode_go

  • baseURL: https://opencode.ai/zen/go (removed trailing /v1, added by transformer)
  • defaultModels: glm-5.1, glm-5, kimi-k2.5, kimi-k2.6, deepseek-v4-pro, deepseek-v4-flash, mimo-v2.5, mimo-v2.5-pro

OpenAI-Compatible Models (use opencode_go channel)

Model API Format
glm-5.1 OpenAI Compatible
glm-5 OpenAI Compatible
kimi-k2.5 OpenAI Compatible
kimi-k2.6 OpenAI Compatible
deepseek-v4-pro OpenAI Compatible
deepseek-v4-flash OpenAI Compatible
mimo-v2.5 OpenAI Compatible
mimo-v2.5-pro OpenAI Compatible

Technical Details

Backend

  • Ent schema: New opencode_go_anthropic enum value in internal/ent/schema/channel.go
  • channel_llm.go: Separate case using anthropic.PlatformDirect transformer, following bailian_anthropic pattern
  • Generated files: Migration schema, GraphQL enum, internal schema updated

Frontend

  • config_channels.ts: New channel config with Anthropic API format, updated opencode_go config
  • config_providers.ts: opencode_go provider now lists both channel types
  • schema.ts: Zod enum updated
  • i18n: Display name OpenCode Go (Anthropic) in English and Chinese

Files Changed

File Description
internal/ent/schema/channel.go Add enum value
internal/ent/channel/channel.go Add type constant and validator
internal/server/biz/channel_llm.go Add PlatformDirect transformer case
internal/server/gql/ent.graphql GraphQL enum
internal/ent/internal/schema.go Generated schema
internal/ent/migrate/schema.go Migration schema
frontend/src/features/channels/data/config_channels.ts Channel configs
frontend/src/features/channels/data/config_providers.ts Provider mapping
frontend/src/features/channels/data/schema.ts Zod schema
frontend/src/locales/en/channels.json English i18n
frontend/src/locales/zh-CN/channels.json Chinese i18n

Testing

Verified against live OpenCode Go API with PostgresSQL backend:

  • Non-streaming message (qwen3.5-plus): Correctly returns thinking + tool_use blocks
  • Streaming message (qwen3.5-plus): Complete SSE events (message_start → content_block_start thinking →
    content_block_delta → tool_use → message_stop)
  • Tool calling: Bash tool call parameters are passed correctly
  • Multiple models: qwen3.5-plus,qwen3.6-plus, minimax-m3 all work correctly
  • Lint: ESLint + go vet passes

Notes

  • Some models (e.g., deepseek-v4-flash) are routed to DeepSeek backend by OpenCode Go gateway, which expects OpenAI
    tool format. These should use opencode_go channel type instead.
  • The opencode_go_anthropic channel type is intended for models that natively support Anthropic Messages API format.

…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-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an opencode_go_anthropic channel type to support the Anthropic Messages API format for OpenCode Go, and updates the existing opencode_go channel with accurate default models and a corrected base URL. The implementation follows the established pattern used by bailian_anthropic and other Anthropic-variant channels throughout the codebase.

  • Backend: New TypeOpencodeGoAnthropic constant, validator entry, GraphQL enum value, and a channel_llm.go case using anthropic.PlatformDirect — all consistent with prior Anthropic-variant additions. Generated Ent files updated accordingly; no separate SQL migration is needed as the project relies on Ent auto-migration for enum additions.
  • Frontend: New opencode_go_anthropic channel config using ANTHROPIC_MESSAGES format, added to the opencode_go provider's channelTypes, Zod enum, and both EN/ZH-CN i18n files. The head commit (955bab67) also removes the dead opencode_go_anthropic entry that was mistakenly included in the Provider union type.

Confidence Score: 5/5

Safe 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

Filename Overview
internal/ent/schema/channel.go Adds opencode_go_anthropic to the Ent schema enum, consistent with all other Anthropic-variant channel additions.
internal/ent/channel/channel.go Adds TypeOpencodeGoAnthropic constant and includes it in the TypeValidator switch — matches the established pattern for every other channel type.
internal/server/biz/channel_llm.go Adds a new TypeOpencodeGoAnthropic case using anthropic.PlatformDirect transformer, identical in behaviour to the existing TypeBailianAnthropic/TypeMoonshotCoding case; a previously-flagged suggestion to consolidate these into one case is outstanding.
internal/server/gql/ent.graphql GraphQL ChannelType enum updated with opencode_go_anthropic — straightforward, no issues.
frontend/src/features/channels/data/config_channels.ts Adds opencode_go_anthropic channel config with correct ANTHROPIC_MESSAGES API format; updates opencode_go defaultModels and baseURL (trailing /v1 removed, added by transformer); dead opencode_go_anthropic member removed from Provider union in the head commit.
frontend/src/features/channels/data/config_providers.ts Adds opencode_go_anthropic to the opencode_go provider's channelTypes array — correct.
frontend/src/features/channels/data/schema.ts Zod channelTypeSchema enum updated with opencode_go_anthropic — no issues.
frontend/src/locales/en/channels.json Adds channels.types.opencode_go_anthropic i18n key in English.
frontend/src/locales/zh-CN/channels.json Adds channels.types.opencode_go_anthropic i18n key in Chinese.

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]
Loading

Reviews (2): Last reviewed commit: "fix(channels): remove dead 'opencode_go_..." | Re-trigger Greptile

Comment thread frontend/src/features/channels/data/config_channels.ts
…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.
@looplj looplj merged commit 4ae2e5d into looplj:unstable Jun 7, 2026
4 checks passed
junjiangao pushed a commit to junjiangao/axonhub that referenced this pull request Jun 9, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants