Qianfan Provider: Access Baidu Models via Unified API
This page covers OpenClaw's official Qianfan plugin, which connects to Baidu's MaaS platform through an OpenAI-compatible API. It explains setup, authentication, and configuration for developers using Qianfan models.
Read this when
- You want a single API key for many LLMs
- You need Baidu Qianfan setup guidance
Qianfan is Baidu's MaaS offering: a single OpenAI-compatible API that funnels requests to various models through one endpoint and API key. OpenClaw includes it as the official external plugin @openclaw/qianfan-provider.
| Property | Value |
|---|---|
| Provider | qianfan |
| Auth | QIANFAN_API_KEY |
| API | OpenAI-compatible (openai-completions) |
| Base URL | https://qianfan.baidubce.com/v2 |
| Default model | qianfan/deepseek-v4-pro |
Install plugin
Get the official plugin installed, then restart Gateway:
openclaw plugins install @openclaw/qianfan-provider
openclaw gateway restart
Getting started
Create a Baidu Cloud account
Head to the Qianfan Console to sign up or log in, and confirm that Qianfan API access is turned on for your account.
Generate an API key
Pick an existing application or start a new one, then generate an API key. Keys from Baidu Cloud follow the bce-v3/ALTAK-... format.
Run onboarding
openclaw onboard --auth-choice qianfan-api-key
When running non-interactively, the key is pulled from --qianfan-api-key <key> or
QIANFAN_API_KEY. During onboarding, the provider config gets written, the
QIANFAN alias is added for the default model, and qianfan/deepseek-v4-pro
becomes the default model if none is already set.
Verify the model is available
openclaw models list --provider qianfan
Built-in catalog
| Model ref | Input | Context | Max output | Reasoning | Notes |
|---|---|---|---|---|---|
qianfan/deepseek-v4-pro | text | 1,000,000 | 393,216 | Yes | Current DeepSeek flagship |
qianfan/ernie-5.1 | text | 128,000 | 65,536 | No | Latest ERNIE text flagship |
qianfan/ernie-5.0 | text, image | 128,000 | 65,536 | Yes | Current multimodal and thinking model |
qianfan/deepseek-v3.2 | text | 128,000 | 32,768 | No | Deprecated onboarding compatibility default; replaced by deepseek-v4-pro |
qianfan/ernie-5.0-thinking-preview | text, image | 128,000 | 65,536 | Yes | Deprecated alias; replaced by ernie-5.0 |
The catalog is fixed; live model discovery is not available.
Tip
Overriding
models.providers.qianfanis only necessary if you need a custom base URL or model metadata.
Config example
This example picks the current DeepSeek flagship explicitly, rather than relying on the onboarding compatibility default.
{
env: { vars: { QIANFAN_API_KEY: "bce-v3/ALTAK-..." } },
agents: {
defaults: {
model: { primary: "qianfan/deepseek-v4-pro" },
models: {
"qianfan/deepseek-v4-pro": { alias: "QIANFAN" },
},
},
},
models: {
providers: {
qianfan: {
baseUrl: "https://qianfan.baidubce.com/v2",
api: "openai-completions",
models: [
{
id: "deepseek-v4-pro",
name: "DeepSeek V4 Pro",
reasoning: true,
input: ["text"],
cost: {
input: 1.771957,
output: 3.543915,
cacheRead: 0.147663,
cacheWrite: 0,
},
contextWindow: 1000000,
maxTokens: 393216,
},
],
},
},
},
}
Note
Model refs carry the
qianfan/prefix (such asqianfan/deepseek-v4-pro).
Transport and compatibility
Qianfan uses the OpenAI-compatible transport path, not native OpenAI request shaping. Standard OpenAI SDK features function normally, though provider-specific parameters might not be passed through.
Troubleshooting
- Verify your API key begins with
bce-v3/ALTAK-and that Qianfan API access is enabled in the Baidu Cloud console. - If models don't show up, check that the Qianfan service is activated on your account.
- Modify the base URL only when using a custom endpoint or proxy.
Related
-
Model selection, How to choose providers, model refs, and failover behavior.
-
Configuration reference, The complete OpenClaw configuration reference.
-
Agent setup, Setting up agent defaults and model assignments.
-
Qianfan API docs, Official documentation for the Qianfan API.