Skip to content

feat: add Anthropic endpoints for Volcengine, AiHubMix, and Xiaomi MiMo#1521

Merged
looplj merged 14 commits into
looplj:unstablefrom
banlanzs:unstable
Apr 28, 2026
Merged

feat: add Anthropic endpoints for Volcengine, AiHubMix, and Xiaomi MiMo#1521
looplj merged 14 commits into
looplj:unstablefrom
banlanzs:unstable

Conversation

@banlanzs

@banlanzs banlanzs commented Apr 28, 2026

Copy link
Copy Markdown
Contributor
image

banlanzs added 13 commits April 23, 2026 14:56
…es with UI checkbox support

- Add bailian_anthropic (Anthropic format) at https://dashscope.aliyuncs.com/apps/anthropic
- Add moonshot_coding (Kimi Coding endpoint) at https://api.kimi.com/coding
- Both use anthropic/messages format with anthropic.PlatformDirect transformer
- Implement checkbox UI pattern (like Gemini Vertex/Anthropic AWS) for Kimi Coding selection
- Fix handleKimiCodingChange to properly update form.type and form.baseURL on toggle
- Add English/Chinese i18n keys for new channel types and Kimi Coding checkbox
- Update Ent schema, channel configs, provider mappings, and generated code

Follows dual/triple-channel pattern used by Minimax, Moonshot, Doubao providers.
- Reset useKimiCoding on provider change, initialRow change, and dialog open/close
- Merge TypeBailianAnthropic and TypeMoonshotCoding switch cases
- Change navigate({ to: '/dashboard' }) to navigate({ to: '/' })
- Dashboard is at root route, not /dashboard
- Fixes broken navigation when clicking '返回仪表盘' button
- Add missing ContentSection import in channel-success-rates page
- Replace useMemo with useEffect for page reset side effect
- Internationalize hardcoded Chinese labels (今天/本周/本月)
- Replace <a> with Link component for SPA navigation in dashboard
The dist directory is gitignored but go:embed all:dist/*
requires at least one file to compile. Add .gitkeep to fix
CI build failures while keeping frontend artifacts untracked.
@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds three new Anthropic-format channel types — volcengine_anthropic, aihubmix_anthropic, and xiaomi_anthropic — by extending the backend enum, Ent schema, GraphQL types, and frontend configs. All three are wired through PlatformDirect in channel_llm.go alongside TypeAnthropic and TypeMinimaxAnthropic. The routeTree.gen.ts file was also auto-regenerated, removing trailing slashes from several route full-paths.

Confidence Score: 4/5

Safe to merge after verifying the volcengine_anthropic base URL path and confirming the web-search beta header behavior is acceptable for the three new providers

Two previously raised P1 concerns in the changed files remain unaddressed: the suspicious /api/coding path for volcengine_anthropic (which would silently send requests to an incorrect endpoint), and the web-search beta header being injected into all three new PlatformDirect providers when native web-search tools are present. All other schema, enum, and frontend changes are mechanically correct.

internal/server/biz/channel_llm.go (PlatformDirect beta header inheritance) and frontend/src/features/channels/data/config_channels.ts (volcengine_anthropic base URL path)

Important Files Changed

Filename Overview
internal/server/biz/channel_llm.go Adds TypeVolcengineAnthropic, TypeAihubmixAnthropic, TypeXiaomiAnthropic to the PlatformDirect case — inherits the web-search beta header injection path that other third-party Anthropic providers (doubao_anthropic) explicitly avoid via a dedicated platform type
frontend/src/features/channels/data/config_channels.ts Adds UI configs for the three new channel types; volcengine_anthropic uses /api/coding base path (previously flagged as potentially wrong); aihubmix_anthropic and xiaomi_anthropic look reasonable
internal/ent/schema/channel.go Correctly extends the channel type enum with xiaomi_anthropic, volcengine_anthropic, and aihubmix_anthropic
internal/ent/channel/channel.go Adds three new Type constants and includes them in TypeValidator; consistent with the schema changes
internal/server/gql/ent.graphql Adds the three new enum values to ChannelType in the GraphQL schema; no other changes
frontend/src/features/channels/data/schema.ts Extends channelTypeSchema Zod enum with the three new channel types; consistent with other additions
frontend/src/features/channels/data/config_providers.ts Adds new channel types to their respective provider groups (volcengine, aihubmix, xiaomi)
frontend/src/routeTree.gen.ts Auto-generated file; removes trailing slashes from many route fullPaths and changes _authenticated fullPath from '/' to '' — looks like a TanStack Router regeneration; changes are mechanical but the _authenticated fullPath shift is notable
internal/ent/migrate/schema.go Auto-generated migration schema; correctly includes all three new enum values in the channel type column definition
internal/ent/internal/schema.go Auto-generated internal schema snapshot; updated to include new channel types, no manual changes needed

Sequence Diagram

sequenceDiagram
    participant Client
    participant ChannelService as channel_llm.go
    participant Transformer as anthropic/outbound.go
    participant Provider as Third-Party Provider

    Client->>ChannelService: buildChannelWithTransformer(c)
    Note over ChannelService: case TypeVolcengineAnthropic,<br/>TypeAihubmixAnthropic,<br/>TypeXiaomiAnthropic
    ChannelService->>Transformer: NewOutboundTransformerWithConfig(PlatformDirect, baseURL)
    Note over Transformer: NormalizeBaseURL(baseURL, "v1")<br/>e.g. aihubmix.com → aihubmix.com/v1
    Transformer-->>ChannelService: OutboundTransformer

    Client->>Transformer: TransformRequest(llmReq)
    Note over Transformer: if containsNativeWebSearchTool<br/>AND PlatformDirect →<br/>inject Anthropic-Beta: web-search-2025-03-05
    Transformer->>Provider: POST baseURL + /messages
    Provider-->>Transformer: response
    Transformer-->>Client: transformed response
Loading

Reviews (5): Last reviewed commit: "fix: use AiHubMix icon for aihubmix_anth..." | Re-trigger Greptile

Comment thread frontend/src/features/channels/data/config_channels.ts
Comment thread internal/server/biz/channel_llm.go

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for new Anthropic-compatible channel types (xiaomi_anthropic, volcengine_anthropic, and aihubmix_anthropic) across the frontend and backend. The review identified two issues: the aihubmix_anthropic channel should use the AiHubMix icon instead of the OpenAI icon for consistency, and the volcengine_anthropic channel should be handled using the specialized PlatformDoubao transformer rather than the generic PlatformDirect transformer to ensure proper Ark-specific logic.

Comment thread frontend/src/features/channels/data/config_channels.ts Outdated
Comment thread internal/server/biz/channel_llm.go
使用与 provider 一致的 AiHubMix 图标,提升品牌识别度。
@banlanzs banlanzs marked this pull request as draft April 28, 2026 07:37
@banlanzs banlanzs marked this pull request as ready for review April 28, 2026 07:38
@banlanzs banlanzs changed the title feat: add Anthropic endpoints for Volcengine, AiHubMix, and Xiaomi MiMo feat: add Anthropic endpoints for Volcengine, AiHubMix, and Xiaomi MiMo;add token usage to channel success rates Apr 28, 2026
Comment thread internal/server/gql/dashboard.resolvers.go Outdated
@looplj

looplj commented Apr 28, 2026

Copy link
Copy Markdown
Owner

token usage 分为独立的 API 吧。

应该可以复用已有请求?

@looplj

looplj commented Apr 28, 2026

Copy link
Copy Markdown
Owner

token usage
改动拆到独立的 PR 吧

@banlanzs

Copy link
Copy Markdown
Contributor Author

好的🆗

@banlanzs

Copy link
Copy Markdown
Contributor Author

已拆分

@banlanzs banlanzs changed the title feat: add Anthropic endpoints for Volcengine, AiHubMix, and Xiaomi MiMo;add token usage to channel success rates feat: add Anthropic endpoints for Volcengine, AiHubMix, and Xiaomi MiMo Apr 28, 2026
@looplj looplj merged commit 0c1277b into looplj:unstable Apr 28, 2026
8 checks passed
@banlanzs banlanzs deleted the unstable branch April 29, 2026 05:05
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