llm-api-adapter-zai
Official direct Z.ai / GLM Chat Completions API support for
llm-api-adapter. The package
targets Core >=0.9.7,<1.0.0 and does not install a provider SDK.
Installation
Install through the Core package extra:
pip install "llm-api-adapter[zai]"
Direct installation is also supported when Core is managed separately:
pip install llm-api-adapter-zai
Async requests need HTTPX:
pip install "llm-api-adapter[zai,async]"
Synchronous requests use requests by default. To opt into HTTPX for sync
chat() and stream_chat(), install "llm-api-adapter[zai,httpx]" and pass
transport="httpx".
Quick start
import os
from llm_api_adapter.models.messages.chat_message import UserMessage
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter
adapter = UniversalLLMAPIAdapter(
organization="zai",
model="glm-5.3-flash",
api_key=os.environ["ZAI_API_KEY"],
)
response = adapter.chat(
messages=[UserMessage("Explain retrieval-augmented generation.")],
max_tokens=128,
)
print(response.content)
Supported model and capabilities
The package deliberately exposes one exact, verified model ID:
glm-5.3-flash.
| Capability | glm-5.3-flash |
|---|---|
| Text chat; sync/async streaming | Supported through the official Chat Completions endpoint |
| Application function tools | tool_choice="auto" only; at most 128 declarations |
| Reasoning | Core reasoning_level is mapped to Z.ai effort; kept separate from visible text |
| Image input | User-message URL, bytes, and data-URL forms |
| Usage | Valid provider usage only; missing or malformed usage is unavailable |
| Portable JSON Schema / Pydantic output | Unsupported; rejected before HTTP |
| Documents and generic files | Unsupported; rejected before HTTP |
| Deployments, uploads, OCR, retries, continuation, and video | Unsupported |
Unknown, retired, aliased, or unverified model IDs are not inferred. Unsupported
tool choices, parallel-tool control, provider-built-in tools, and every
DocumentPart URL or byte form fail locally before the transport is called.
The adapter accepts only the official endpoint and the ZAI_API_KEY bearer
credential.
See the main llm-api-adapter README for the shared API contract and transport behavior.
Metadata
Release files for llm-api-adapter-zai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_api_adapter_zai-0.1.0.tar.gz | 21.2 kB | Without provenance | Details for llm_api_adapter_zai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_api_adapter_zai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for llm_api_adapter_zai-0.1.0-py3-none-any.whl |
Total release size: 40.3 kB
Release files / llm_api_adapter_zai-0.1.0.tar.gz
| Download URL | llm_api_adapter_zai-0.1.0.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67fea978ca1a26cc17c1869d60cffa25ca89a18cf6ff4da580e3b85d3208330f
|
|
BLAKE2b-256 checksum How to use checksums |
f941d19fc94cc561c74fbf58136258cfe0576d19c2b44ce900dd359c045e6219
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / llm_api_adapter_zai-0.1.0-py3-none-any.whl
| Download URL | llm_api_adapter_zai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a95458c2d0a59c7a584b3be3e88863892cd82c536a657a0622653c945833f711
|
|
BLAKE2b-256 checksum How to use checksums |
a1b6ef681ecf3e28bc710a9112ddb23ffbec94f047dc1df227437984502cb3cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for llm-api-adapter-zai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.