The API reference describes the RESTful APIs you can use to interact with the Z.AI platform.
Z.AI provides standard HTTP API interfaces that support multiple programming languages and development environments, with SDKs also available.

Authentication

The Z.AI API uses the standard HTTP Bearer for authentication. An API key is required, which you can create or manage on the API Keys Page. API keys should be provided via HTTP Bearer Authentication in HTTP Request Headers.
Authorization: Bearer ZAI_API_KEY

Playground

The API Playground allows developers to quickly try out API calls. Simply click Try it on the API details page to get started.
  • On the API details page, there are many interactive options, such as switching input types, switching tabs, and adding new content.
  • You can click Add an item or Add new property to add more properties the API need.
  • Note that when switching the tabs, the previous properties value you need re-input or re-switch.

Call Examples

curl -X POST "https://api.z.ai/api/paas/v4/chat/completions" \
-H "Content-Type: application/json" \
-H "Accept-Language: en-US,en" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
    "model": "glm-4.5",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful AI assistant."
        },
        {
            "role": "user",
            "content": "Hello, please introduce yourself."
        }
    ],
    "temperature": 0.6,
    "stream": true
}'