AI EngineerGuide

Anthropic API format for GLM Coding Plan

by Ashik Nesin Ashik Nesin

GLM Coding Plan supports both Anthropic API messages API format as well as OpenAI messages format.

So if you want to use the GLM Coding plan with say your Claude Code or an Claude SDK, you can use just change their base url and pass on your ZAI API key which should do the trick.

https://api.z.ai/api/anthropic

For example, your request will be something like this

curl -X POST https://api.z.ai/api/anthropic/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $ZAI_API_KEY" \
  -d '{
    "model": "glm-5-turbo",
    "max_tokens": 100,
    "messages": [
      {"role": "user", "content": "Why sky is blue?"}
    ]
  }'

2026-04-15-at-22.44.40.png

Stay Updated

Get the latest AI engineering insights delivered to your inbox.

No spam. Unsubscribe at any time.