Skip to main content
Tired of limits? GLM Coding Plan — monthly access to world-class model GLM-4.6, compatible with top coding tools like Claude Code and Cline. All from just $3/month. Try it now →
Black Friday: Enjoy 50% off your first GLM Coding Plan purchase, plus an extra 20%/30% off! Subscribe now.

Getting Started

1

Get API Key

4

Make API Call

After preparing your API Key and selecting a model, you can start making API calls. Here are examples using curl, Python SDK, and Java SDK:
  • cURL
  • Official Python SDK
  • Official Java SDK
  • OpenAI Python SDK
  • OpenAI NodeJs SDK
  • OpenAI Java SDK
Note: When using the GLM Coding Plan, you need to configure the dedicated
Coding endpoint - https://api.z.ai/api/coding/paas/v4
instead of the general endpoint - https://api.z.ai/api/paas/v4
Note: The Coding API endpoint is only for Coding scenarios and is not applicable to general API scenarios. Please use them accordingly.
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.6",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful AI assistant."
        },
        {
            "role": "user",
            "content": "Hello, please introduce yourself."
        }
    ]
}'

Get More