feat: deepseek claude endpoint - #1832
Conversation
WalkthroughAdded Claude adaptor support in deepseek channel. ConvertClaudeRequest now uses claude.Adaptor. Request URL construction branches by RelayFormat: Claude routes to /anthropic/v1/messages; non-Claude preserves beta handling and selects /completions or /v1/chat/completions based on RelayMode. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant DeepSeekAdaptor as DeepSeek Adaptor
participant ClaudeAdaptor as Claude Adaptor
participant OpenAIAdaptor as OpenAI Adaptor
participant Channel as Channel API
Client->>DeepSeekAdaptor: Request (RelayFormat, RelayMode, BaseURL)
alt RelayFormat == Claude
DeepSeekAdaptor->>ClaudeAdaptor: ConvertClaudeRequest(...)
Note over DeepSeekAdaptor: URL = BaseURL + "/anthropic/v1/messages"
DeepSeekAdaptor->>Channel: POST /anthropic/v1/messages
else Non-Claude
DeepSeekAdaptor->>OpenAIAdaptor: Convert request (existing path)
Note over DeepSeekAdaptor: Ensure BaseURL ends with "/beta" when needed
alt RelayMode == Completions
DeepSeekAdaptor->>Channel: POST .../beta/completions
else Chat Completions
DeepSeekAdaptor->>Channel: POST /v1/chat/completions
end
end
Channel-->>DeepSeekAdaptor: Response
DeepSeekAdaptor-->>Client: Relay response
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
relay/channel/deepseek/adaptor.go (1)
54-59: Consider the URL construction logic for consistency.The URL construction logic has an inconsistency: for
RelayModeCompletions, it usesfimBaseUrl(with/betaappended), but for the default case, it usesinfo.ChannelBaseUrldirectly. This could lead to different behavior depending on the relay mode.Consider making the URL construction more consistent:
switch info.RelayMode { case constant.RelayModeCompletions: return fmt.Sprintf("%s/completions", fimBaseUrl), nil default: - return fmt.Sprintf("%s/v1/chat/completions", info.ChannelBaseUrl), nil + return fmt.Sprintf("%s/v1/chat/completions", fimBaseUrl), nil }Or if the beta URL is only needed for completions mode, add a comment explaining this behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
relay/channel/deepseek/adaptor.go(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
relay/channel/deepseek/adaptor.go (4)
relay/channel/openai/adaptor.go (1)
Adaptor(32-35)relay/channel/claude/adaptor.go (1)
Adaptor(23-25)types/relay_format.go (2)
RelayFormat(3-3)RelayFormatClaude(7-7)relay/constant/relay_mode.go (1)
RelayModeCompletions(11-11)
…aude-code feat: deepseek claude endpoint
Summary by CodeRabbit