Qwen 是怎么把自己模拟成 claude 的啊 #916
Replies: 7 comments
-
|
你在环境变量里设置: 然后你运行claude code,你得环境变量就会覆盖掉,让你在claude code里运行这个第三方的模型。我这个变量风格是linux的,你要是用windows就是 $env:ANTHROPIC_BASE_URL = "",这样的命令格式来覆盖当前环境变量(只在当前终端窗口生效) |
Beta Was this translation helpful? Give feedback.
-
|
哦,这个 base_url 后端逻辑没有啥啥特殊的吗 但是如果上面的是也可以的,那 @musistudio/claude-code-router 这个中转的包又有啥用呢 |
Beta Was this translation helpful? Give feedback.
-
有影响,因为常规的url风格是openai格式兼容的,anthropic的风格和openai兼容的风格是不一样的。所以如果你要是计划在claude code里用,那你需要使用anthropic兼容的url,这样claude code才能解析模型返回的信息从而调用claude code的内置工具。如果你是在这个qwen code cli里用,那你需要用正常openai兼容风格的url。所以在qwen code用就是export OPNEAI_BASE_URL="官方提供的openai兼容风格的url" |
Beta Was this translation helpful? Give feedback.
-
因为有些模型供应商没有兼容anthropic,他们只有openai兼容的风格。阿里、硅基流动、glm,KIMI这些都是直接支持anthropic风格url的。你只要环境变量一覆盖就可以直接用claude code。但是比如说你想用modelscope魔搭社区提供的免费qwen3-coder,这个平台暂时还不支持anthropic风格,只有openai兼容风格的url,你通过claude code router路由一下,就可以让你在claude code里就用魔搭社区的模型了。 |
Beta Was this translation helpful? Give feedback.
-
|
claude code router 我试过这个方式去使用qwen3-code-plus,但是这种方式使用,过程中会有一些 json 解析的报错,基本是必现的,直接随便一个项目使用就能出现这个问题 |
Beta Was this translation helpful? Give feedback.
-
|
现在让我标记已完成的任务并继续处理下一个任务: 就这种问题,反复出现 |
Beta Was this translation helpful? Give feedback.
-
阿里这种官方支持anthropic格式的,你就直接用claude code好一些。环境变量里一覆盖,直接用,我试了下没有问题
|
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://dashscope.aliyuncs.com/api/v2/apps/claude-code-proxy
官网让配置了这个 base_url
这个接口咋模拟的自己是 claude 呢
Beta Was this translation helpful? Give feedback.
All reactions