Docs · Providers

Baidu Qianfan Token Plan in Claude Code and Codex

Baidu Qianfan (百度千帆) has two Token Plans, personal and enterprise, and pay as you go, each with endpoints and keys of its own. Add Baidu Qianfan in magpie with each key's plan, and Claude Code, Codex, Gemini CLI, OpenCode and other tools use Qianfan's DeepSeek and GLM through magpie's local gateway on 127.0.0.1:3425.

Add Baidu Qianfan

  1. Add the provider and pick the planOn Providers, click + Add provider, pick Baidu Qianfan, set the key's plan to Token Plan Personal, Token Plan Enterprise, Pay as you go, paste the key and save.
  2. Pick it for a toolOn Agents, pick a model such as qianfan-code-latest or deepseek-v4-pro on a tool's row.
Terminal
magpie claude baidu-qianfan/qianfan-code-latest
magpie codex baidu-qianfan/deepseek-v4-pro
magpie opencode baidu-qianfan/glm-5.3

Plans and endpoints

PlanChat Completions and ResponsesAnthropic Messages
Token Plan personalhttps://qianfan.baidubce.com/v2/tokenplan/personalhttps://qianfan.baidubce.com/anthropic/tokenplan/personal
Token Plan enterprisehttps://qianfan.baidubce.com/v2/tokenplan/teamhttps://qianfan.baidubce.com/anthropic/tokenplan/team
Pay as you gohttps://qianfan.baidubce.com/v2https://qianfan.baidubce.com/anthropic

Each plan's key works at its own endpoints. Each key in the provider names its plan, so personal, enterprise and pay-as-you-go keys can share one provider, and each key's requests go to its own plan's endpoint.

The plans' models

The plans' /models answers 404, so magpie gives the models from both plans' docs: qianfan-code-latest, deepseek-v4.1-flash, deepseek-v4-pro, deepseek-v4-pro-0813, deepseek-v4-flash-0731, glm-5.3, glm-5.3-flash, glm-5.2, glm-5.1, among others. deepseek-v4-flash, deepseek-v3.2 and glm-5 are the enterprise plan's alone. qianfan-code-latest is whichever model the console has picked. A pay-as-you-go key reads Qianfan's /v2/models.

In each agent

FAQ

How do I use the Baidu Qianfan Token Plan in Claude Code?

Add Baidu Qianfan in magpie with the key's plan set to Token Plan Personal or Enterprise, then pick qianfan-code-latest on Claude Code's row, or run magpie claude baidu-qianfan/qianfan-code-latest. Requests go to the plan's Anthropic endpoint, such as https://qianfan.baidubce.com/anthropic/tokenplan/personal.

Which model is qianfan-code-latest?

The one you picked for the plan in Qianfan's console. Change it there; the name in magpie and your tools stays the same.

Do the personal and enterprise plans have the same models?

Mostly. deepseek-v4-flash, deepseek-v3.2 and glm-5 are the enterprise plan's alone; deepseek-v4-pro, glm-5.3 and the others are in both.

Does Baidu Qianfan work in Codex?

Yes. Qianfan's plan endpoints serve OpenAI Responses, so magpie passes Codex's requests through. Run magpie codex baidu-qianfan/deepseek-v4-pro, or pick it on Codex's row.

The same for other providers: Volcengine Ark, Tencent Cloud, GLM Coding Plan, Kimi, DeepSeek, Qwen. Hit an error? See troubleshooting, or ask on Discord.