Docs · Providers
ModelScope in Claude Code and Codex
ModelScope's (魔搭) API-Inference takes a ModelScope account's access token as its key and serves models such as Qwen and GLM over Chat Completions and Responses. Add ModelScope in magpie, and Claude Code, Codex, Gemini CLI and OpenCode use them through magpie's local gateway on 127.0.0.1:3425.
Add ModelScope
- Add the providerOn Providers, click + Add provider, pick ModelScope, use your ModelScope access token as the key, paste the key and save.
- Pick it for a toolOn Agents, pick a model such as Qwen/Qwen3-Coder-30B-A3B-Instruct on a tool's row.
magpie claude modelscope/Qwen/Qwen3-Coder-30B-A3B-Instruct magpie codex modelscope/ZhipuAI/GLM-4.6 magpie opencode modelscope/Qwen/Qwen3-235B-A22B-Instruct-2507
Endpoint and token
| API | Endpoint |
|---|---|
| Chat Completions | https://api-inference.modelscope.cn/v1 |
| Responses | https://api-inference.modelscope.cn/v1 |
The key is a ModelScope account's access token, made at modelscope.cn/my/myaccesstoken. ModelScope is not Alibaba Cloud's DashScope: a DashScope key goes in the Qwen provider, and neither works on the other. A provider added by hand at api-inference.modelscope.cn is taken as ModelScope too.
Models
ModelScope's model names carry their organisation, written as they are: Qwen/Qwen3-Coder-30B-A3B-Instruct, Qwen/Qwen3-235B-A22B-Instruct-2507, Qwen/Qwen3-235B-A22B-Thinking-2507, ZhipuAI/GLM-4.6, ZhipuAI/GLM-4.5, among others. magpie takes their names and context from models.dev's modelscope catalog. On the command line, write modelscope/ then the name.
In each agent
- Claude Code speaks Anthropic Messages, which this provider doesn't serve. magpie converts each request to Chat Completions and the reply back, reasoning included. Claude Code with other models.
- Codex speaks OpenAI Responses. It serves Responses too, so Codex's requests go as they are. Codex with other models.
- Gemini CLI speaks Gemini's API; magpie converts it to Chat Completions. Gemini CLI with other models.
- OpenCode speaks Chat Completions, so requests go as they are. OpenCode with other models.
Images
ModelScope draws through async tasks of its own: a request starts a task and answers its task_id, which is asked about until it succeeds or fails. It runs one task of a user's at a time and answers bursts with 429, so magpie asks for one image at a time, waits a moment when it is busy, and hands the result to your tool as an image it can read.
FAQ
How do I use ModelScope in Claude Code?
Add ModelScope in magpie with your access token as the key, then pick Qwen/Qwen3-Coder-30B-A3B-Instruct on Claude Code's row, or run magpie claude modelscope/Qwen/Qwen3-Coder-30B-A3B-Instruct. ModelScope has no Anthropic endpoint, so magpie converts to Chat Completions.
Where do I get a ModelScope key?
ModelScope uses your account's access token, made at modelscope.cn/my/myaccesstoken. Paste it into magpie's ModelScope provider.
Is ModelScope the same as Alibaba's DashScope?
No. ModelScope's API-Inference is at api-inference.modelscope.cn on a ModelScope access token; DashScope takes an Alibaba Cloud key and is magpie's Qwen provider.
Does ModelScope work in Codex?
Yes. ModelScope serves Responses, so magpie passes Codex's requests through. Run magpie codex modelscope/ZhipuAI/GLM-4.6.
The same for other providers: SiliconFlow, Volcengine Ark, GLM Coding Plan, Kimi, DeepSeek, Qwen. Hit an error? See troubleshooting, or ask on Discord.