Qianfan Provider: Access Baidu Models via OpenAI-Compatible API
Learn how to use the Qianfan provider in OpenClaw to access Baidu's MaaS platform. This guide covers installation, authentication, and setup for developers using the unified API.
Read this when
- You want a single API key for many LLMs
- You need Baidu Qianfan setup guidance
Qianfan is Baidu's MaaS platform. It provides a unified, OpenAI-compatible API that directs requests to multiple models through a single 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-v3.2 |
Install plugin
Install the official plugin, then restart Gateway:
openclaw plugins install @openclaw/qianfan-provider
openclaw gateway restart
Getting started
Create a Baidu Cloud account
Sign up or log in at the Qianfan Console and make sure Qianfan API access is enabled for your account.
Generate an API key
Create a new application or pick an existing one, then generate an API key. Baidu Cloud keys follow the bce-v3/ALTAK-... format.
Run onboarding
openclaw onboard --auth-choice qianfan-api-key
Non-interactive runs read the key from --qianfan-api-key <key> or
QIANFAN_API_KEY. Onboarding writes the provider config, adds the
QIANFAN alias for the default model, and sets qianfan/deepseek-v3.2
as the default model when none is configured.
Verify the model is available
openclaw models list --provider qianfan
Built-in catalog
| Model ref | Input | Context | Max output | Reasoning | Notes |
|---|---|---|---|---|---|
qianfan/deepseek-v3.2 | text | 98,304 | 32,768 | Yes | Default model |
qianfan/ernie-5.0-thinking-preview | text, image | 119,000 | 64,000 | Yes | Multimodal |
The catalog is static. Live model discovery is not available.
Tip
Override
models.providers.qianfanonly when you need a custom base URL or model metadata.
Config example
{
env: { QIANFAN_API_KEY: "bce-v3/ALTAK-..." },
agents: {
defaults: {
model: { primary: "qianfan/deepseek-v3.2" },
models: {
"qianfan/deepseek-v3.2": { alias: "QIANFAN" },
},
},
},
models: {
providers: {
qianfan: {
baseUrl: "https://qianfan.baidubce.com/v2",
api: "openai-completions",
models: [
{
id: "deepseek-v3.2",
name: "DEEPSEEK V3.2",
reasoning: true,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 98304,
maxTokens: 32768,
},
{
id: "ernie-5.0-thinking-preview",
name: "ERNIE-5.0-Thinking-Preview",
reasoning: true,
input: ["text", "image"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 119000,
maxTokens: 64000,
},
],
},
},
},
}
Note
Model refs use the
qianfan/prefix (for exampleqianfan/deepseek-v3.2).
Transport and compatibility
Qianfan uses the OpenAI-compatible transport path, not native OpenAI request shaping. Standard OpenAI SDK features work, but provider-specific parameters might not be forwarded.
Troubleshooting
- Confirm your API key starts with
bce-v3/ALTAK-and that Qianfan API access is enabled in the Baidu Cloud console. - If models do not appear, verify that the Qianfan service is activated on your account.
- Only modify the base URL if you are using a custom endpoint or proxy.
Related
-
Model selection, Choosing providers, model refs, and failover behavior.
-
Configuration reference, Full OpenClaw configuration reference.
-
Agent setup, Configuring agent defaults and model assignments.
-
Qianfan API docs, Official Qianfan API documentation.