Claude Code Multi-Model Launcher
This file is agent-facing instructions consumed by Claude Code at runtime. If you are a human looking for install / usage docs, read README.md instead (Chinese).
Claude Code reads the env vars ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL (plus per-slot overrides) at startup. Many third-party providers (z.ai, DeepSeek, Alibaba Bailian, Moonshot, etc.) expose an Anthropic-compatible endpoint, so pointing those env vars at the provider + launching claude is all it takes to route every request through that backend.
This skill installs one launcher per provider so the user can switch backends by typing a short command (glm, ds, qwen, ...).
Workflow
-
Confirm what the user wants. Ask (if unclear):
- Which provider? (GLM / DeepSeek / Qwen / Kimi / custom)
- API key.
- Preferred alias name (default: short provider abbreviation).
- OS / shell — see the Platform Matrix table below. Common cases: Windows native (Git Bash + PowerShell), macOS (Zsh default), Linux (Bash/Zsh/Fish), WSL2 (Linux inside Windows).
- Auto-detect WSL2: run
grep -qi microsoft /proc/version 2>/dev/null && echo wsl2— if it printswsl2, treat as WSL2 (Linux rules apply; no.ps1needed).
-
Look up the endpoint. Use the Known Endpoints table below. If the provider is not listed, ask the user for the doc URL and use
WebFetch/WebSearch. Do not guess endpoint URLs. -
Create the launcher script(s). Location:
~/.claude/claude-<alias>.{sh,ps1}. Platform rules:- Windows native: create both
.sh(for Git Bash) and.ps1(for PowerShell). - macOS / Linux / WSL2: create only
.sh. After writing, runchmod +x ~/.claude/claude-<alias>.sh. - WSL2 users do not need a
.ps1— they runclaudeinside the Linux layer.
- Windows native: create both
-
Wire up shell aliases. Choose the section that matches the user's environment:
Bash (Linux / WSL2 / Git Bash on Windows):
echo "alias <alias>='~/.claude/claude-<alias>.sh'" >> ~/.bashrcThen remind the user to open a new terminal (or run
source ~/.bashrc).Zsh (macOS default since Catalina 10.15; also common on Linux):
echo "alias <alias>='~/.claude/claude-<alias>.sh'" >> ~/.zshrcThen open a new terminal (or run
source ~/.zshrc).Fish (Linux/macOS):
echo "alias <alias> '~/.claude/claude-<alias>.sh'" >> ~/.config/fish/config.fishFish alias syntax omits
=. Open a new terminal to reload.PowerShell (Windows native — PowerShell 5.1 or 7):
# Create profile dir if missing, then append if (!(Test-Path $PROFILE)) { New-Item -Path $PROFILE -ItemType File -Force } Add-Content $PROFILE "`nfunction <alias> { & `"`$env:USERPROFILE\.claude\claude-<alias>.ps1`" @args }"Note: Windows PowerShell 5.1 (
$PROFILEunderDocuments\WindowsPowerShell) and PowerShell 7 (Documents\PowerShell) use different profile paths. Write to the one the user actually runs.macOS Bash (users who switched back or use older macOS pre-Catalina): Append to
~/.bash_profile(macOS does not auto-source~/.bashrcin login shells):echo "alias <alias>='~/.claude/claude-<alias>.sh'" >> ~/.bash_profile -
Tell the user to open a NEW shell window (aliases/functions do not load into existing sessions) and run
<alias>to test. Warn that a 403 usually means a wrongBASE_URLor a key from the wrong plan tier. -
Never embed the user's API key in chat output after the fact. If the user has pasted a key into conversation, remind them once to rotate if they are worried about shoulder-surfing or screenshot leaks — do not nag on every turn.
Platform Matrix
Quick reference — choose the row that matches the user's OS + shell:
| Environment | Scripts to create | Shell config file | Alias syntax |
|---|---|---|---|
| Windows + Git Bash | .sh + .ps1 | ~/.bashrc | alias ds='~/.claude/claude-ds.sh' |
| Windows + PowerShell 5.1 | .ps1 (+ .sh optional) | $PROFILE (WindowsPowerShell) | function ds { & "..." @args } |
| Windows + PowerShell 7 | .ps1 (+ .sh optional) | $PROFILE (PowerShell) | same as above |
| WSL2 (Bash) | .sh only | ~/.bashrc | alias ds='~/.claude/claude-ds.sh' |
| WSL2 (Zsh) | .sh only | ~/.zshrc | alias ds='~/.claude/claude-ds.sh' |
| macOS (Zsh, default ≥ Catalina) | .sh only | ~/.zshrc | alias ds='~/.claude/claude-ds.sh' |
| macOS (Bash, pre-Catalina / custom) | .sh only | ~/.bash_profile | alias ds='~/.claude/claude-ds.sh' |
| Linux (Bash) | .sh only | ~/.bashrc | alias ds='~/.claude/claude-ds.sh' |
| Linux (Zsh) | .sh only | ~/.zshrc | alias ds='~/.claude/claude-ds.sh' |
| Linux (Fish) | .sh only | ~/.config/fish/config.fish | alias ds '~/.claude/claude-ds.sh' |
WSL2 detection: grep -qi microsoft /proc/version 2>/dev/null && echo wsl2
Script Templates
~/.claude/claude-<alias>.sh (Unix shell):
#!/bin/bash
# Launch Claude Code with <Provider> backend
export ANTHROPIC_AUTH_TOKEN="<API_KEY>"
export ANTHROPIC_BASE_URL="<BASE_URL>"
export ANTHROPIC_MODEL="<DEFAULT_MODEL>"
export ANTHROPIC_DEFAULT_OPUS_MODEL="<OPUS_SLOT_MODEL>"
export ANTHROPIC_DEFAULT_SONNET_MODEL="<SONNET_SLOT_MODEL>"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="<HAIKU_SLOT_MODEL>"
# Optional: small/fast background model, subagent model, provider-specific tuning
claude "$@"
Make it executable via chmod +x.
~/.claude/claude-<alias>.ps1 (PowerShell):
# Launch Claude Code with <Provider> backend
$env:ANTHROPIC_AUTH_TOKEN = "<API_KEY>"
$env:ANTHROPIC_BASE_URL = "<BASE_URL>"
$env:ANTHROPIC_MODEL = "<DEFAULT_MODEL>"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "<OPUS_SLOT_MODEL>"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "<SONNET_SLOT_MODEL>"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "<HAIKU_SLOT_MODEL>"
claude @args
PowerShell execution policy must allow local scripts (RemoteSigned or Unrestricted for CurrentUser). Check with Get-ExecutionPolicy -Scope CurrentUser; if it is Restricted, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.
Known Endpoints
These values were verified against official provider docs. Keep this table updated.
| Provider | ANTHROPIC_BASE_URL | Key prefix | Typical model names |
|---|---|---|---|
| z.ai (GLM) | https://api.z.ai/api/anthropic | regular | glm-5.1 |
| DeepSeek | https://api.deepseek.com/anthropic | sk-... | deepseek-v4-pro (Opus/Sonnet), deepseek-v4-flash (Haiku) |
| Alibaba Bailian — Coding Plan (monthly subscription) | https://coding.dashscope.aliyuncs.com/apps/anthropic | sk-sp-... | qwen3.6-plus, qwen3.6-flash, qwen3-coder-next |
| Alibaba Bailian — pay-as-you-go | https://dashscope.aliyuncs.com/apps/anthropic | sk-... | same as above |
| Moonshot / Kimi | https://api.moonshot.cn/anthropic | sk-... | kimi-k2-... (confirm current name from Moonshot docs) |
Slot-mapping guidance
Claude Code requests different model slots depending on the task. Ask the provider's docs for their recommendation; if none, default to:
OPUS/SONNET→ the provider's strongest coding model.HAIKU/SMALL_FAST→ the provider's cheapest/fastest model (used for summarization, titling, background work).CLAUDE_CODE_SUBAGENT_MODEL→ same as Opus/Sonnet (subagents do heavy work).
Provider-specific gotchas
- Alibaba Bailian Coding Plan keys (
sk-sp-...) MUST use thecoding.dashscope.aliyuncs.comsubdomain. Mixing ask-sp-key with the genericdashscope.aliyuncs.comendpoint (or vice versa) returns 403 invalid-key. The Coding Plan also only works in coding tools (Claude Code, Qwen Code) —curl/ Postman will be rejected. - DeepSeek recommends
CLAUDE_CODE_EFFORT_LEVEL=max,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, `CLAUDE_CO