HAI Gateway Docs

GLM

GLM Anthropic Messages

Call Zhipu GLM series models via the Anthropic Messages compatible endpoint, with support for thinking and tool calling.

POSTv1/messages

Authorizations

x-api-keystringheaderrequired

sk-pat-YourAccessToken

anthropic-versionstringheaderrequired

API version, currently 2023-06-01

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

Body Parameters

The request body format is compatible with the Anthropic Messages API. 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:Streaming
curl https://api.hai.network/compatible-preview/anthropic/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk-pat-YourAccessToken" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "glm-4.6",
    "stream": true,
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Summarize the contributions of the Transformer architecture in three points"
      }
    ]
  }'