--- id: qianfan version: "0.4.12.3" license: Apache-2.0 license_treatment: permissive maintenance: aging --- # qianfan — 文心千帆大模型平台 Python SDK License: permissive · Maintenance: aging · Downloads: 234.1K/mo ## 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 above — verify before relying. Python SDK for Baidu Qianfan large language model platform, enabling chat, text completion, embeddings, image generation, model training, and dataset management through a unified API. 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 pip install qianfan uv add qianfan poetry add qianfan ## Installing qianfan 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. 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"]) 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. 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_current - Install friction: low - Maintenance: aging - Downloads: 234.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags baidu qianfan sdk, llm api client baidu, chat completion embedding, model training management, text to image generation, large language model platform, qianfan python client, baidu-cloud, llm-client, async-http [View on SkillFed](https://skillfed.io/packages/qianfan) · [View on PyPI](https://pypi.org/project/qianfan/)