zai-sdk
A SDK library for accessing big model apis from Z.ai
What it is and what it does
The zai-sdk is the official Python client library for Z.ai's large model open platform. It wraps Z.ai's REST APIs into a Python interface, letting developers call chat models, generate embeddings, create videos from text or images, transcribe audio, and manage conversations without building HTTP requests manually. The SDK handles authentication via API keys, supports both synchronous and asynchronous operations, and includes streaming for real-time responses.
The package is built on httpx for HTTP transport, pydantic for request/response validation, and standard utilities like cachetools and pyjwt. It targets Python 3.8 and later across Windows, macOS, and Linux. Typical use cases include integrating Z.ai's GLM models into chatbots, building multimodal applications that process images, and batch-processing embeddings or video generation requests.
Use it for:
- Build a chatbot or conversational AI using Z.ai's GLM models with streaming responses.
- Generate vector embeddings for text data to power semantic search or similarity matching.
- Create videos programmatically from text prompts or images using the video generation API.
- Transcribe audio files to text using Z.ai's speech recognition capabilities.
- Implement tool-calling workflows where the model can invoke functions or web search during conversations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Official Python SDK for Z.ai's large model APIs, providing access to chat completions, embeddings, video generation, audio processing, and assistant features.
Yes, if you are actively using Z.ai's platform. The SDK is actively maintained, has low install friction, and provides a clean Python interface to Z.ai's APIs. However, verify the license terms before use in proprietary projects, since the license status is currently unclear in the package metadata.
Install
zai-sdk on PyPI
pip
pip install zai-sdkuv
uv add zai-sdkpoetry
poetry add zai-sdkInstalling zai-sdk
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance status with recent releases. Standard dependencies (httpx, pydantic, cachetools, pyjwt) are well-established.
License in practice
License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms before using in proprietary or restricted contexts.
Quickstart
pip install zai-sdk
from zai import ZaiClient
client = ZaiClient(api_key="your-api-key")
response = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
Requires a valid Z.ai API key; obtain from https://docs.z.ai/ (overseas) or https://www.bigmodel.cn/ (mainland China).
Verify before relying
- Actual license terms and restrictions—metadata shows no SPDX or raw license field
- Whether all advertised features (video generation, audio transcription, web search) are available in all API tiers
- Rate limits and quota policies for different model endpoints
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — cachetools, httpx, pydantic, pydantic-core, pyjwt, sniffio |
| Maintenance | actively maintained — 59 days since the last release |
| First released | |
| Downloads | 119,579/month — #12,064 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zai_sdk-0.2.3-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
dashscopePython SDK for Alibaba Cloud Model Studio…
permissive · top 5,000 on PyPI
zhipuaiOfficial Python SDK for ZhipuAI's large model…
unclear · top 15,000 on PyPI
ai21Python SDK for accessing AI21 Labs' language…
unclear · top 15,000 on PyPI
gigachatPython SDK for the GigaChat REST API, a large…
permissive · top 15,000 on PyPI
foundry-local-sdkA Python SDK for discovering, downloading,…
permissive · top 15,000 on PyPI
vlmrunPython SDK for the VLM Run API platform,…
permissive · top 15,000 on PyPI
qianfanPython SDK for Baidu Qianfan large language…
permissive · top 15,000 on PyPI
honcho-aiPython SDK for the Honcho conversational memory…
permissive · top 15,000 on PyPI
mistralaiPython client SDK for the Mistral AI API,…
unclear · top 1,000 on PyPI
elevenlabsOfficial Python SDK for ElevenLabs…
permissive · top 5,000 on PyPI