HAI Gateway Docs

GLM

GLM Chat Completions

Guide for calling Zhipu GLM series models via the Alibaba Bailian proxy (preview channel)

POSTv1/chat/completions

Authorizations

Authorizationstringheaderrequired

OpenAI-compatible channel: Bearer sk-pat-YourAccessToken

The key value is your HAI Gateway Personal Access Token (starting with sk-pat-). No separate API key from Zhipu or Alibaba Cloud is required.

Base URL

OpenAI-compatible:

Body Parameters

The request body format is compatible with the Alibaba Bailian OpenAI-compatible interface. For detailed parameter descriptions, refer to the official documentation.

The developer role is not supported

The OpenAI-compatible endpoint only accepts system / user / assistant roles. The Anthropic channel follows the official user / assistant conversation structure, with system messages passed via the top-level system field.

cURL
cURL:Default
curl https://api.hai.network/compatible-preview/openai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-pat-YourAccessToken" \
  -d '{
    "model": "glm-4.6",
    "messages": [
      {
        "role": "user",
        "content": "Introduce the GLM series"
      }
    ]
  }'