qianfan
文心千帆大模型平台 Python SDK
Decision gist · record as of 2026-08-14
Yes, with conditions. Install if you are building on Baidu's Qianfan platform and need a Python client—the SDK is officially maintained, permissively licensed, and has low install friction. However, note that maintenance is aging (553 days since last release), so verify that the current version supports your target models and features before committing to production. No known security vulnerabilities as of the last OSV check.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or higher; Baidu Qianfan platform credentials (Access Key and Secret Key) must be obtained from Baidu Cloud console and set as environment variables.
- Low install friction with a pure-Python wheel distribution.
- Maintenance status is aging—last commit was 2025-12-12 and the package has not received a release in 553 days, though the repository remains active and not archived.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions—suitable for most production and proprietary projects.
last release 2025-02-07 (553 days) · last repo commit 2025-12-12 · 383 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 234,138 downloads/mo, #9,028 on PyPI
Alternatives
Verify before relying
pip install qianfan
import os
import qianfan
os.environ["QIANFAN_ACCESS_KEY"] = "..."
os.environ["QIANFAN_SECRET_KEY"] = "..."
chat_comp = qianfan.ChatCompletion(model="ERNIE-4.0-8K")
resp = chat_comp.do(messages=[{"role": "user", "content": "hello"}])
print(resp["result"])- Whether the aging maintenance status (553 days since last release) affects stability or feature parity with the Baidu platform.
- Performance characteristics and rate-limiting behavior under high-concurrency workloads given the aiolimiter dependency.
- Whether all 16 runtime dependencies are actively maintained and free of known vulnerabilities beyond the OSV check.
What it is and what it does
Qianfan is Baidu's official Python SDK for accessing the Qianfan large language model platform. It wraps HTTP and async HTTP calls to Baidu's inference, training, and model management services, handling authentication, request formatting, and response parsing. The SDK supports multiple authentication modes (Access Key/Secret Key or legacy API Key/Secret Key) and exposes high-level interfaces for chat, text completion, embeddings, image generation, and model lifecycle operations.
The package is designed for developers integrating Baidu's LLM capabilities into Python applications. It manages 16 runtime dependencies including requests, aiohttp, pydantic for validation, tenacity for retry logic, and rich for CLI output. Configuration is flexible—credentials can be set via environment variables, .env files, or code. The SDK also provides tokenization utilities, rate limiting, and prompt management, making it a comprehensive client for the Qianfan ecosystem.
Use it for
- Build chatbot or conversational AI applications using ERNIE models via the ChatCompletion interface.
- Generate text embeddings for semantic search, clustering, or retrieval-augmented generation workflows.
- Fine-tune Baidu's large language models on custom datasets using the model training API.
- Generate images from text prompts using the Text2Image capability within the Qianfan platform.
- Manage datasets, models, and deployments programmatically through the model management and service APIs.
- Integrate Qianfan's plugin ecosystem and external tools into Python applications via the plugin interface.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
Install if you are building on Baidu's Qianfan platform and need a Python client—the SDK is officially maintained, permissively licensed, and has low install friction. However, note that maintenance is aging (553 days since last release), so verify that the current version supports your target models and features before committing to production. No known security vulnerabilities as of the last OSV check.
Install
qianfan on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance status is aging—last commit was 2025-12-12 and the package has not received a release in 553 days, though the repository remains active and not archived.
Requires Python 3.7 or higher; Baidu Qianfan platform credentials (Access Key and Secret Key) must be obtained from Baidu Cloud console and set as environment variables.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and distribution with minimal restrictions—suitable for most production and proprietary projects.
Quickstart
pip install qianfan
import os
import qianfan
os.environ["QIANFAN_ACCESS_KEY"] = "..."
os.environ["QIANFAN_SECRET_KEY"] = "..."
chat_comp = qianfan.ChatCompletion(model="ERNIE-4.0-8K")
resp = chat_comp.do(messages=[{"role": "user", "content": "hello"}])
print(resp["result"])
Verify before relying
- Whether the aging maintenance status (553 days since last release) affects stability or feature parity with the Baidu platform.
- Performance characteristics and rate-limiting behavior under high-concurrency workloads given the aiolimiter dependency.
- Whether all 16 runtime dependencies are actively maintained and free of known vulnerabilities beyond the OSV check.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release <4,>=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 16 packagesrequestsaiohttpaiolimiterimportlib-metadatabce-python-sdktyping-extensionspydanticpython-dotenvtenacitymultiprocessrichtyperpyyamlprompt-toolkitdiskcachecachetools |
| Maintenance | Aging 553 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 234,138 / month, #9,028 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: qianfan-0.4.12.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “baidu qianfan sdk”
- qianfanPython SDK for Baidu Qianfan large language model platform, enabling…
- aistudio-sdkPython client library for the AIStudio API, enabling developers to…
- serpapiOfficial Python client for SerpApi that queries multiple search…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also aistudio-sdk · langchain-ibm · volcengine · langchainplus-sdk · ai21 · zai-sdk · gigachat · ollama · volcengine-python-sdk · zhipuai