Z.AI provides standard HTTP API interfaces that support multiple programming languages and development environments, allowing you to easily integrate Z.AI’s powerful capabilities.
curl --location 'https://api.z.ai/api/paas/v4/chat/completions' \--header 'Authorization: Bearer YOUR_API_KEY' \--header 'Accept-Language: en-US,en' \--header 'Content-Type: application/json' \--data '{ "model": "glm-4.5", "messages": [ { "role": "system", "content": "You are a professional programming assistant" }, { "role": "user", "content": "What is recursion?" }, { "role": "assistant", "content": "Recursion is a programming technique where a function calls itself to solve problems..." }, { "role": "user", "content": "Can you give me an example of Python recursion?" } ]}'
It is recommended to use HTTPS protocol in production environments and implement appropriate security measures to protect your API keys and data transmission.