How to Integrate Qianfan AI Models in Openclaw

Qianfan is Baidu's AI platform offering powerful models like ERNIE and other Chinese-optimized LLMs. This guide walks you through integrating Qianfan models into your Openclaw setup.
Quick Start
Get a Qianfan API Key
- Sign in to your Baidu Cloud account and navigate to the Qianfan Console.
- Create a new application or select an existing one.
- Generate an API key. The format looks like
bce-v3/ALTAK-... - Copy the API key to your clipboard.
Configure Openclaw
Run the onboarding wizard to authenticate with Qianfan:
openclaw onboard --auth-choice qianfan-api-key
For more authentication options, check out our guide on LiteLLM Models Openclaw.
Set Qianfan as Your Default Model
Once authenticated, configure your default model in ~/.openclaw/openclaw.json:
{
"agents": {
"defaults": {
"model": { "primary": "qianfan/ernie-bot-4" }
}
}
}
Available models include qianfan/ernie-bot-4, qianfan/ernie-bot-turbo, and other Baidu models.
Example Usage
After setup, you can interact with Qianfan models directly:
openclaw ask "Explain quantum computing in simple terms"
Or use it in your agent workflows for Chinese language tasks, coding assistance, or general AI interactions.
Troubleshooting
- Authentication errors: Ensure your API key starts with bce-v3/ and hasn't expired.
- Region issues: Qianfan works best for China-based deployments; consider latency if hosting elsewhere.
- Model not found: Verify the model ID matches exactly what's available in your Qianfan console.
If you're deploying Openclaw on cloud platforms, see our Deploy Flyio Openclaw guide for production-ready setups.
