Skip to content

fix: replace Alibaba's Claude-compatible url with new url - #2702

Merged
Calcium-Ion merged 2 commits into
QuantumNous:mainfrom
seefs001:fix/ali-baseurl
Jan 21, 2026
Merged

Calcium-Ion merged 2 commits into
QuantumNous:mainfrom
seefs001:fix/ali-baseurl

Conversation

@seefs001

@seefs001 seefs001 commented Jan 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added compatibility with additional Anthropic-style models (e.g., Qwen-family), enabling them to be used where Claude-compatible models were supported.
    • Streaming responses are preserved when using these compatible models.
  • Bug Fixes

    • Improved request routing so model-specific requests are sent to the correct endpoints, reducing failures and improving response consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds model-based branching in the Ali channel Claude adaptor: detect AliAnthropic-compatible models, route requests and responses either to Anthropic/v1 messages (using Claude handlers) or convert/delegate to OpenAI-style handling; updates request URL selection and response routing accordingly.

Changes

Cohort / File(s) Summary
Ali Claude adaptor
relay/channel/ali/adaptor.go
Added supportsAliAnthropicMessages detection (model name check), changed GetRequestURL to select Anthropic v1 messages endpoint for detected models, updated ConvertClaudeRequest to return original Claude request for those models (otherwise convert to OpenAI-like request), and adjusted DoResponse to route streaming/non-streaming flows to Claude handlers or delegate to openai.Adaptor. Also added import of service and a small helper for branching.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AliAdaptor
  participant ClaudeHandlers
  participant OpenAIAdaptor
  participant AnthropicAPI
  participant OpenAIAPI

  Client->>AliAdaptor: Send Claude-format request (with model)
  AliAdaptor->>AliAdaptor: supportsAliAnthropicMessages(model)?
  alt model supports AliAnthropic
    AliAdaptor->>ClaudeHandlers: handle request (stream? / standard)
    ClaudeHandlers->>AnthropicAPI: call Anthropic v1/messages
    AnthropicAPI-->>ClaudeHandlers: response/stream
    ClaudeHandlers-->>AliAdaptor: relay response
    AliAdaptor-->>Client: return response/stream
  else not supported
    AliAdaptor->>OpenAIAdaptor: convert request to OpenAI-like
    OpenAIAdaptor->>OpenAIAPI: forward request
    OpenAIAPI-->>OpenAIAdaptor: response/stream
    OpenAIAdaptor-->>AliAdaptor: relay response
    AliAdaptor-->>Client: return response/stream
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Calcium-Ion

Poem

🐰🌿 I sniffed the model name and hopped with glee,
Some paths now go Anthropic, some sail to OpenAI sea.
A tiny helper, a route well-placed,
Streams and responses gracefully traced.
Hooray — a rabbit's nudge, swift and free!

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title claims to replace a Claude-compatible URL, but the actual changes implement AliAnthropic message format support with conditional routing logic, which is broader than just a URL replacement. Consider revising the title to better reflect the core change, such as 'Add AliAnthropic message format support with conditional request routing' to accurately represent the implementation.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seefs001 seefs001 linked an issue Jan 20, 2026 that may be closed by this pull request
@Calcium-Ion
Calcium-Ion merged commit 824c7a2 into QuantumNous:main Jan 21, 2026
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
fix: replace Alibaba's Claude-compatible url with new url
@coderabbitai coderabbitai Bot mentioned this pull request Mar 23, 2026
4 tasks
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
fix: replace Alibaba's Claude-compatible url with new url
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
fix: replace Alibaba's Claude-compatible url with new url
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.

claude code兼容接口使用阿里云的glm-4.7不生效

2 participants