ERNIE API

Baidu's ERNIE models through its Qianfan platform, with an OpenAI-compatible API on Baidu AI Cloud's international and mainland China sites.

Ask your AI about this, with this page as the source:ChatGPT ↗Claude ↗Perplexity ↗

The ERNIE API is how you call Baidu's ERNIE models: ERNIE 5.1 and 5.0, with 128K tokens of context and thinking and vision variants, and the cheaper ERNIE 4.5 Turbo models. They're served through Qianfan, Baidu AI Cloud's model platform, which also includes an agent and app builder; the mainland site resells third-party models such as DeepSeek and GLM as well. There's an international site (intl.cloud.baidu.com) and a mainland China site with prices in yuan.

On the international site, the chat API is OpenAI-compatible: point the OpenAI SDK at https://api.baiduqianfan.ai/v1 and send a Qianfan API key as a bearer token. The same key can be scoped to Qianfan's app builder and other AI services. Baidu also publishes its own Qianfan SDKs for Python and JavaScript.

Useful for a small team: ERNIE 4.5 Turbo lists at $0.11 per million input tokens on the international site, and Baidu has published the ERNIE 4.5 family as open weights on Hugging Face under Apache 2.0, so you can serve those models yourself. The hosted ERNIE 5.x models are billed at a higher rate for prompts over 32K tokens.

Limits: Baidu Holdings Limited runs the international platform, and its agreement says your data may be processed in other countries where its affiliates or partners run Qianfan facilities. It also tells you not to submit confidential information and says Baidu has no confidentiality obligation over your content.

Where it fits

Who uses it

No maker's live product on record yet, and 6 open-source projects that declare it in their code.

We haven't found a maker's live product that uses ERNIE API yet — only the open-source projects below, which declare it in their code.

Open source: a project that declares ERNIE API as a dependency in its public code — verifiable, but not necessarily a live product.

Alternatives to ERNIE API

All alternatives by situation →

Questions makers ask about ERNIE API

Can I use the OpenAI SDK?

Yes. Set the base URL to https://api.baiduqianfan.ai/v1 and pass your Qianfan API key (it starts with bce-v3/) as the API key. An optional appid header ties calls to a Qianfan app. source ↗

Does Baidu use my inputs and outputs?

The user agreement says inputs, outputs and uploaded datasets are your data, for use under your account, and that beyond performing the service Baidu won't make unauthorized use or disclosure of them. It doesn't separately address model training. source ↗

Where is my data processed?

Not in a fixed region. The agreement says data may be processed in countries where Qianfan facilities run by Baidu's affiliates or partners are located, which can mean cross-border transfers, and that you're responsible for your end users' consent to them. source ↗

Can I send confidential data?

The agreement says you shouldn't provide confidential information to the service, that Baidu has no confidentiality obligation over your content, and that it has no obligation to keep copies of it. source ↗

How is usage priced?

Per token, by model. ERNIE 5.1 and 5.0 have two input-length tiers, up to 32K tokens and 32K–128K, with the longer tier costing more for both input and output. source ↗

How much does ERNIE API cost?

Paid use starts at Pay per token. source ↗

Is ERNIE API open source or self-hostable?

Not open source, and hosted only.

Can AI coding agents work with ERNIE API?

No llms.txt, official MCP server or CLI found yet.

Who uses ERNIE API?

No maker's live product we track yet; 6 open-source projects declare it in their code. source ↗