HAI Gateway 文档中心

GLM

GLM Chat Completions

阿里百炼代理的智谱 GLM 系列模型调用指南(预览通道)

POSTv1/chat/completions

Authorizations

Authorizationstringheaderrequired

OpenAI 兼容通道:Bearer sk-pat-您的AccessToken

密钥的值使用HAI Gateway的个人访问令牌(以 sk-pat- 开头),无需在智谱或阿里云处单独申请 API Key。

Base URL

OpenAI 兼容:

Body 参数

请求体格式与阿里云百炼 OpenAI 兼容接口一致,详细参数说明请参考官方文档。

不支持 developer 角色

OpenAI 兼容入口只接受 system / user / assistant 三种 role;Anthropic 通道遵循官方 user / assistant 对话结构,system 单独通过顶层 system 字段传入。

cURL
cURL:Default
curl https://api.hai.network/compatible-preview/openai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-pat-您的Access Token" \
  -d '{
    "model": "glm-4.6",
    "messages": [
      {
        "role": "user",
        "content": "介绍一下 GLM 系列"
      }
    ]
  }'