Qianfan (Baidu)
Qianfan is Baidu’s MaaS platform that provides a unified OpenAI-compatible API for ERNIE and DeepSeek models. A single API key gives you access to all available models.Prerequisites
- A Baidu Cloud account with Qianfan API access enabled
- A Qianfan API key (format:
bce-v3/ALTAK-...) from the Qianfan Console
Quick setup
1. Get an API key
Sign in to the Qianfan Console and create an API key. Keys start withbce-v3/ALTAK-.
Store it on the gateway host:
2. Run onboarding
3. Configure
apiKey is the name of the environment variable, not the key value itself. Keep secrets in .env, not in committed config files.Provider settings
| Setting | Value |
|---|---|
| Provider ID | qianfan |
| Base URL | https://qianfan.baidubce.com/v2 |
| API | OpenAI-compatible |
| Auth env var | QIANFAN_API_KEY |
Verification
Available models
| Model ID | Context | Max tokens | Notes |
|---|---|---|---|
deepseek-v3.2 | 98,304 | 32,768 | Default; reasoning |
ernie-5.0-thinking-preview | 119,000 | 64,000 | Reasoning; vision |
qianfan/<model-id> — for example, qianfan/deepseek-v3.2.
Troubleshooting
401 Unauthorized
401 Unauthorized
Model not found
Model not found
Confirm the model ID matches exactly (case-sensitive) and that your Qianfan account has access to the requested model.
API access not enabled
API access not enabled
Ensure your Baidu Cloud account has Qianfan API access enabled in the console. Some model families require separate activation.