新增账号支持使用 Chat Completions 协议上游#2255
Open
DASungta wants to merge 3 commits intoWei-Shaw:mainfrom
Open
Conversation
…pletions bridge Introduce a new account type `apikey-chat-completions` that allows forwarding Anthropic/Responses API traffic to upstreams that only speak the OpenAI Chat Completions protocol. Includes: - ent schema: widen `type` column to 40 chars; add `strip_reasoning_effort_on_cc` field - migrations 020/021 for the schema changes - apicompat: bidirectional Responses↔ChatCompletions converters (`responses_to_chatcompletions_request`, `chatcompletions_to_responses_response`) - fix: preserve tool messages with call_id in normalizeChatMessagesForToolCallPairs - service: gateway routing for the new account type (Claude raw + Anthropic-as-CC + Responses-to-CC) - handler/admin: surface strip_reasoning_effort_on_cc in account CRUD API - frontend: add strip_reasoning_effort_on_cc toggle to CreateAccountModal & EditAccountModal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
All contributors have signed the CLA. ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
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
apikey-chat-completions账号类型,将 Anthropic Messages / OpenAI Responses API 流量桥接到只支持 Chat Completions 协议的上游(如 b.ai 等)strip_reasoning_effort_on_cc账号字段,适配拒绝reasoning_effort参数的 Chat Completions 上游Responses↔ChatCompletions(apicompat包),附完整单元测试链式覆盖Changes
Backend
ent/schema/accounttype字段扩至 40 字符;新增strip_reasoning_effort_on_ccbool 字段migrations/020accounts.type列migrations/021strip_reasoning_effort_on_cc列internal/pkg/apicompatresponses_to_chatcompletions_request.go+chatcompletions_to_responses_response.go及对应测试internal/servicegateway_claude_chat_completions_raw.go、gateway_forward_anthropic_as_cc.go、openai_gateway_responses_to_cc.go及对应测试internal/handler/openai_gateway_handlerinternal/handler/adminFrontend
CreateAccountModal.vue/EditAccountModal.vue:新增strip_reasoning_effort_on_cc开关i18n/locales/en.ts/zh.ts:补充新字段国际化文案Test plan
go test -tags=unit ./...全部通过(TestResolvePageImagePath为 macOS/private/var预存失败,与本 PR 无关)apicompat链式转换测试:Responses→CC 请求转换、CC→Responses 响应转换anthropic_messages_apikey_cc、openai_chat_completions_apikey_cc、openai_responses_apikey_ccgo build ./...编译通过ent/目录)🤖 Generated with Claude Code