How I'm Using Z.ai as a Claude Code Fallback with a Simple PowerShell Switch
April 2026 has been a bit of a shit show from Anthropic in terms of how they're handling peoples usage limits, and the degradation of Sonnet and Opus 4.6. Then they bring out Opus 4.7 which is a regression due to it now forcing 'adaptive-thinking'.
On top of the degradation, I've gone from rarely hitting my usage limit to hitting it within an hour or two consistently.
I looked through different alternatives:
- Codex
- Cursor
- OpenCode
- Github Copilot
- Local models with Ollama
Most of these were not suitable for me. I don't want to support OpenAI, I don't want a pay-as-you-go style system, and I only have an RTX 4070 so local LLMs are limited. Github Copilot was a strong contender as a replacement but I wanted to be able to remain within the Claude Code harness.
What's Actually Going On With Anthropic
If you've been following the news on the site formerly known as Twitter and Reddit, you may have seen many people complaining about degradation of service provided by Anthropic.
On March 26, Anthropic quietly adjusted how 5-hour session limits work for Pro subscribers during peak hours, with the claim that roughly "7% of users" would be hitting limits they wouldn't have hit before. Except it appeared to be more widespread than that.
On the performance side it's even worse. Anthropic reduced the default "effort" level Claude uses when answering prompts to cut down on tokens per task. Most users found out about it the hard way when the rate of hallucination shot up.
AMD's Senior Director of AI filed a GitHub issue backed by telemetry from 6,852 Claude Code sessions. Median visible thinking length went from 2,200 characters in January down to 600 by March. API retries increased up to 80x over the same period.
Anthropic say the effort change was documented in the changelog and shown in a dialog when you opened Claude Code. Make of that what you will. Either way, Claude Code feels worse in April 2026 than it did in March 2026 and you're hitting limits faster than before.
That's what sent me looking for a fallback.
Z.AI — GLM 5.1
I've been testing a couple of alternatives for the last two months. My thoughts on Z.AI after a month of use with GLM 5.1 on the Pro Coder tier.
- Limited to 1 concurrent session
- Quite slow. Slower than Claude has been during the first week of April 2026
- Debugging often would not result in a working fix and needed multiple passes
- Would frequently miss out methods required and outlined in larger plans
- Would ask it to do a task, it would analyse, and then ask if you want it to do the task you just asked it
- Usage limits are more generous than Claude but due to the lack of prompt-caching in GLM, raw input tokens are significantly higher than Anthropic's models (~10K vs ~2M input tokens), meaning you burn through limits at a similar pace
Not a replacement. Not close. But good enough for lighter tasks when you're locked out of Claude.
The Solution
A simple PowerShell script that swaps two files in your .claude directory:
settings.json.credentials.json
Flip those two and Claude Code switches from your Anthropic subscription to Z.ai's API billing. Or back.
The Script Walkthrough
param (
[Parameter(Mandatory)]
[ValidateSet("zai", "claude")]
[string]$Target
)
$claudeDir = "$env:USERPROFILE\.claude"
$settingsSrc = "$claudeDir\settings.$Target.json"
$credentialsSrc = "$claudeDir\.credentials.$Target.json"
$settingsDest = "$claudeDir\settings.json"
$credentialsDest = "$claudeDir\.credentials.json"
Copy-Item $settingsSrc -Destination $settingsDest -Force
Copy-Item $credentialsSrc -Destination $credentialsDest -Force
Write-Host "Switched to: $Target" -ForegroundColor Green
You keep two pairs of config files, one per provider. The script overwrites the active ones.
Why both files?
You might assume settings.json is enough. That's where you'd set ANTHROPIC_BASE_URL. But Claude Code reads .credentials.json first. If there's an API key in there pointing at Anthropic's endpoint, it wins regardless of what settings.json says. Took me a moment to realise this.
Only swapping settings.json means you switch the URL but auth still points at the wrong provider. Both files need to change together.
Making It Seamless
Typing .\switch.ps1 -Target zai every time gets old fast.
PowerShell profile ($PROFILE):
function use-zai { & "$env:USERPROFILE\.claude\switch.ps1" -Target zai }
function use-claude { & "$env:USERPROFILE\.claude\switch.ps1" -Target claude }
.bat wrappers for CMD:
use-zai.bat:
@echo off
powershell -ExecutionPolicy Bypass -File "%USERPROFILE%\.claude\switch.ps1" -Target zai
use-claude.bat:
@echo off
powershell -ExecutionPolicy Bypass -File "%USERPROFILE%\.claude\switch.ps1" -Target claude
Drop the .bat files somewhere on your PATH and both commands work from any terminal.
The Result
use-zai
use-claude
Hit a limit, type use-zai, keep building. Quota resets, use-claude, back on native billing. You can resume sessions and use all your existing tools. Just be aware of the token usage on Z.AI.