Skip to main content

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 with bce-v3/ALTAK-. Store it on the gateway host:
echo 'QIANFAN_API_KEY=bce-v3/ALTAK-...' >> ~/.openclaw/.env

2. Run onboarding

openclaw onboard --auth-choice qianfan-api-key
Or non-interactive:
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice qianfan-api-key \
  --qianfan-api-key "bce-v3/ALTAK-..."

3. Configure

{
  models: {
    providers: {
      qianfan: {
        apiKey: "QIANFAN_API_KEY", // references the env var
      },
    },
  },
  agents: {
    defaults: {
      model: { primary: "qianfan/deepseek-v3.2" },
    },
  },
}
apiKey is the name of the environment variable, not the key value itself. Keep secrets in .env, not in committed config files.

Provider settings

SettingValue
Provider IDqianfan
Base URLhttps://qianfan.baidubce.com/v2
APIOpenAI-compatible
Auth env varQIANFAN_API_KEY

Verification

openclaw models status --probe-provider qianfan

Available models

Model IDContextMax tokensNotes
deepseek-v3.298,30432,768Default; reasoning
ernie-5.0-thinking-preview119,00064,000Reasoning; vision
Use model IDs as qianfan/<model-id> — for example, qianfan/deepseek-v3.2.

Troubleshooting

Verify your API key starts with bce-v3/ALTAK- and is copied in full. Re-run openclaw onboard --auth-choice qianfan-api-key to refresh the stored credential.
Confirm the model ID matches exactly (case-sensitive) and that your Qianfan account has access to the requested model.
Ensure your Baidu Cloud account has Qianfan API access enabled in the console. Some model families require separate activation.