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.

PropertyValue
Providerqianfan
AuthQIANFAN_API_KEY
APIOpenAI-compatible (openai-completions)
Base URLhttps://qianfan.baidubce.com/v2
Default modelqianfan/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 refInputContextMax outputReasoningNotes
qianfan/deepseek-v4-protext1,000,000393,216YesCurrent DeepSeek flagship
qianfan/ernie-5.1text128,00065,536NoLatest ERNIE text flagship
qianfan/ernie-5.0text, image128,00065,536YesCurrent multimodal and thinking model
qianfan/deepseek-v3.2text128,00032,768NoDeprecated onboarding compatibility default; replaced by deepseek-v4-pro
qianfan/ernie-5.0-thinking-previewtext, image128,00065,536YesDeprecated alias; replaced by ernie-5.0

The catalog is fixed; live model discovery is not available.

Tip

Overriding models.providers.qianfan is 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 as qianfan/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.
582 words · updated Aug 12, 2026