GLM-5.1 API

GLM-5.1 from Z.ai: a capable general model with image input

z-ai/glm-5.1
Z-AIConversation

About this model

GLM-5.1 is a model in Z.ai’s GLM-5 series, released in April 2026 with a context window of about 200,000 tokens. It is an earlier release than GLM-5.2 and the GLM-5.3 family.

Choose it for tasks that fit in 200,000 tokens, or to keep behavior from that release. Newer models offer longer context: GLM-5.2 and GLM-5.3 reach 1,000,000 tokens.

In this catalog it accepts text and images, with a context window of up to 200,000 tokens.

Use cases

  • General chat and writing
  • Coding help
  • Image questions

Input and output

Input
Text and images
Output
Text

Developer

Developer
Z-AI
Type
Conversation
Context
200,000 tokens
Capabilities
Image input

GLM-5.1 request example

Use https://gatelum.com/v1 as the base URL and pass z-ai/glm-5.1 in the model field. You create the key in your account after signing up.

curl --silent --show-error --fail-with-body \
  --header 'Authorization: Bearer glt_YOUR_KEY' \
  'https://gatelum.com/v1/chat/completions' \
  --header "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "z-ai/glm-5.1",
  "messages": [
    {
      "role": "user",
      "content": "Hi! Tell me about yourself in two sentences."
    }
  ]
}
JSON
Claude Code and Anthropic-protocol clients

For clients using the Anthropic protocol, point the address at ANTHROPIC_BASE_URL=https://gatelum.com with no /v1. The model ID does not change.

macOS / Linux
export ANTHROPIC_BASE_URL=https://gatelum.com
export ANTHROPIC_AUTH_TOKEN=glt_YOUR_KEY
export ANTHROPIC_MODEL=z-ai/glm-5.1
claude

Where to use GLM-5.1

Guides with step-by-step instructions for the tools that support this model: