{"slug": "claude-code-with-glm-5-3-the-setup-that-works", "title": "Claude Code with GLM-5.3: The Setup That Works", "summary": "Running GLM-5.3 through Z.ai on Claude Code 2.1.266 requires setting CLAUDE_CODE_DISABLE_ARTIFACT=1, because Z.ai rejected Claude Code's built-in Artifact tool definition with a `400 [1210] Invalid API parameter` error, according to a setup guide tested on September 9, 2026. The guide also instructs users to register glm-5.3 and glm-5.3-flash in ~/.claude/settings.json via modelPicker options with behavesAs mappings to claude-opus-4-7 and claude-sonnet-4-6 to clear the unknown-model catalog warning, and to set CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000 for the models' 1M-token context window. The author notes that changing the effort level was not the fix and that interactive mode must be tested separately because `claude-zai -p` succeeded while interactive mode failed.", "body_md": "[← Writing](https://nibzard.com/log)\n\n# Claude Code with GLM-5.3: The Setup That Works\n\nRun GLM-5.3 through Z.ai on Claude Code 2.1.266. Fix the 400 error, model warning, and context window.\n\n## Share and tools\n\nMy Z.ai setup broke with the latest CC update. Claude Code warned about an unknown model, then returned `400 [1210] Invalid API parameter`.\n\nThe warning and the failure had separate fixes. Z.ai was rejecting Claude Code’s built-in `Artifact` tool definition. Removing that tool made the same request succeed. Changing the effort level was not the fix, though I spent a while convinced it was.\n\nTested on September 9, 2026 with Claude Code 2.1.266 and GLM-5.3. This is what worked on that version. Gateways change, so re-check if you are reading this later.\n\nThis follows my [multiple-provider setup](https://nibzard.com/claude-dual-provider): one Claude install, shared settings, and a `claude-zai` wrapper that selects the provider.\n\n## [#](#1-update-claude-code) 1. Update Claude Code\n\nUse your existing installation:\n\n```\nclaude update\nclaude --version\n```\n\n## [#](#2-configure-the-zai-wrapper) 2. Configure the Z.ai wrapper\n\nKeep the API key in your existing secret store. This example uses [pass](https://www.passwordstore.org/?utm_source=nibzard.com):\n\n```\npass insert api/zhipu\nmkdir -p ~/bin\n```\n\nSave this as `~/bin/claude-zai`. If you already have a wrapper, update it and keep your existing credential lookup.\n\n``` bash\n#!/usr/bin/env bash\nset -euo pipefail\n\nZAI_TOKEN=\"$(pass show \"${CLAUDE_ZAI_PASS_ENTRY:-api/zhipu}\")\"\nZAI_TOKEN=\"${ZAI_TOKEN%%$'\\n'*}\"\n: \"${ZAI_TOKEN:?Z.ai API key is empty}\"\n\nunset ANTHROPIC_API_KEY ANTHROPIC_MODEL CLAUDE_CONFIG_DIR\n\nexport ANTHROPIC_AUTH_TOKEN=\"$ZAI_TOKEN\"\nexport ANTHROPIC_BASE_URL=\"https://api.z.ai/api/anthropic\"\nexport ANTHROPIC_DEFAULT_OPUS_MODEL=\"glm-5.3\"\nexport ANTHROPIC_DEFAULT_SONNET_MODEL=\"glm-5.3-flash\"\nexport ANTHROPIC_DEFAULT_HAIKU_MODEL=\"glm-5.3-flash\"\nexport API_TIMEOUT_MS=\"3000000\"\n\n# Work around the Artifact tool schema rejected by Z.ai on 2.1.266.\nexport CLAUDE_CODE_DISABLE_ARTIFACT=1\n\n# Use the models' 1M-token context window.\nexport CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000\n\nexec claude \"$@\"\n```\n\nMake it executable and ensure `~/bin` is on your shell’s `PATH`:\n\n```\nchmod +x ~/bin/claude-zai\ncommand -v claude-zai\n```\n\nKeep these exports inside the wrapper. Putting the gateway URL and token in global Claude settings routes your normal Claude sessions through Z.ai too.\n\n`CLAUDE_CODE_DISABLE_ARTIFACT=1` disables Claude’s Artifact tool for this entry point. File editing and shell tools still work. The context setting follows [Z.ai’s 1M configuration](https://docs.z.ai/devpack/tool/claude?utm_source=nibzard.com).\n\n## [#](#3-register-the-models) 3. Register the models\n\nMerge this into `~/.claude/settings.json`. Preserve your existing settings and any other `modelPicker.options` entries.\n\n```\n{\n  \"modelPicker\": {\n    \"options\": [\n      {\n        \"model\": \"glm-5.3\",\n        \"label\": \"GLM-5.3\",\n        \"behavesAs\": \"claude-opus-4-7\"\n      },\n      {\n        \"model\": \"glm-5.3-flash\",\n        \"label\": \"GLM-5.3 Flash\",\n        \"behavesAs\": \"claude-sonnet-4-6\"\n      }\n    ]\n  }\n}\n```\n\n`behavesAs` tells Claude Code which known model’s client-side handling to use. Requests still go to GLM. These entries remove the catalog warning. They do not fix the Artifact error; that fix is the env var from step 2.\n\nI kept my saved `xhigh` setting. The gateway accepted it during testing. What GLM does with that number on its side, I do not know.\n\n## [#](#4-test-interactive-mode) 4. Test interactive mode\n\nExit existing sessions and start a new one:\n\n```\nclaude-zai --model opus\n```\n\nAsk:\n\n```\nUse Bash to run pwd once, then return the directory path.\nDo not change any files.\n```\n\nYou should see GLM-5.3 without the catalog warning, a successful tool call, and a final response without the 400 error. Approve the shell call if prompted.\n\nDo not skip this test. `claude-zai -p` succeeded while interactive mode failed, and interactive mode is what I actually use. The print test nearly convinced me everything worked.\n\n## [#](#give-this-to-your-agent) Give this to your agent\n\nConfigure Claude Code using this article. Inspect and back up my existing settings and provider wrapper first. Reuse my credential store, merge the model entries, and keep Z.ai environment variables scoped to the wrapper. If files are symlinked, edit their source. Verify the installed version and run the interactive `pwd` test. Preserve my other settings and report what changed.\n\nGet more like this in your inbox. Unsubscribe anytime.", "url": "https://wpnews.pro/news/claude-code-with-glm-5-3-the-setup-that-works", "canonical_source": "https://nibzard.com/claude-glm/", "published_at": "2026-09-09 00:00:00+00:00", "updated_at": "2026-10-08 10:19:40.563157+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "developer-tools", "ai-products"], "entities": ["Claude Code", "GLM-5.3", "Z.ai", "GLM-5.3 Flash", "Anthropic", "claude-opus-4-7", "claude-sonnet-4-6", "pass"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/claude-code-with-glm-5-3-the-setup-that-works", "markdown": "https://wpnews.pro/news/claude-code-with-glm-5-3-the-setup-that-works.md", "text": "https://wpnews.pro/news/claude-code-with-glm-5-3-the-setup-that-works.txt", "jsonld": "https://wpnews.pro/news/claude-code-with-glm-5-3-the-setup-that-works.jsonld"}}