AI-Konfigurations-Skill
Konfiguriere KI-Anbieter (Provider) für verschiedene KI-Programmiertools mit nur einem Befehl.
Unterstützte Tools und Anbieter
| Tool | GLM | OpenRouter | OpenAI | Anthropic |
|---|---|---|---|---|
| Claude Code | ✅ | ❌ | ❌ | ✅ |
| Codex CLI | ✅ | ✅ | ✅ | ❌ |
| OpenCode | ✅ | ❌ | ✅ | ❌ |
| Cline | ✅ | ❌ | ✅ | ❌ |
| OpenClaw | ✅ | ❌ | ❌ | ❌ |
Zwei Konfigurationsmethoden
Methode A: Automatische Installation (empfohlen)
Nutze das offizielle Tool für automatische Installation, Konfiguration und MCP-Verwaltung.
GLM (Zhipu Coding Plan) – Ein-Klick-Konfiguration:
npx @z_ai/coding-helper
Dieses Tool erledigt automatisch:
- Tool-Installation (Claude Code / OpenCode / Crush / Factory Droid)
- API-Key-Konfiguration
- Modellpaket-Ladung
- MCP-Server-Verwaltung
OpenCode (mit integrierter GLM-Unterstützung):
opencode auth login
# Wähle "Zhipu AI Coding Plan", gib API-Key ein
opencode
# /models wähle GLM-Modell
Methode B: Vorlagen kopieren
Kopiere vorgefertigte Vorlagen aus ai-config/templates/ an den Zielort. Der Benutzer muss lediglich den API-Key anpassen.
Vorlagendateien der einzelnen Tools und Zielpfade:
| Tool | Vorlagendatei | Kopieren nach |
|---|---|---|
| Claude Code + GLM | templates/claude-code/glm.sh | source ins Terminal |
| Claude Code + GLM-Modell-Map | templates/claude-code/glm-settings.json | Zusammenführen mit ~/.claude/settings.json |
| Claude Code + Anthropic | templates/claude-code/anthropic.sh | source ins Terminal |
| Codex + GLM | templates/codex/glm.toml | ~/.codex/config.toml |
| Codex + OpenRouter | templates/codex/openrouter.toml | ~/.codex/config.toml |
| Codex + OpenAI | templates/codex/openai.toml | ~/.codex/config.toml |
| OpenCode + GLM | templates/opencode/glm.json | ~/.config/opencode/opencode.json |
| OpenCode + OpenAI | templates/opencode/openai.json | ~/.config/opencode/opencode.json |
| Cline + GLM | templates/cline/glm.md | Siehe IDE-interne Konfiguration |
| OpenClaw + GLM | templates/openclaw/glm.json | Zusammenführen mit ~/.openclaw/openclaw.json |
Anleitung
Wenn der Benutzer sagt: „GLM konfigurieren“, „OpenRouter konfigurieren“, „ai-config glm“ usw., dann:
Schritt 1: Anbieter bestätigen
glm→ Vorzug Methode A (npx @z_ai/coding-helper), auch Methode B möglichopenrouter/openai→ Verwende Methode B (Vorlagen kopieren)anthropic→ Verwende Methode B
Schritt 2: Konfiguration ausführen
GLM-Konfiguration (empfohlen: Methode A)
npx @z_ai/coding-helper
Folge der interaktiven Anleitung. Wenn der Benutzer die manuelle Konfiguration bevorzugt, verwende Methode B:
# Claude Code + GLM
source ai-config/templates/claude-code/glm.sh
# Zusammenführen von glm-settings.json mit ~/.claude/settings.json, um das Modell auf GLM-5.1 umzustellen
# Codex CLI + GLM
mkdir -p ~/.codex
cp ai-config/templates/codex/glm.toml ~/.codex/config.toml
# OpenCode + GLM
cp ai-config/templates/opencode/glm.json ~/.config/opencode/opencode.json
OpenRouter / OpenAI-Konfiguration (Methode B)
# Codex CLI + OpenRouter
mkdir -p ~/.codex
cp ai-config/templates/codex/openrouter.toml ~/.codex/config.toml
# Codex CLI + OpenAI
mkdir -p ~/.codex
cp ai-config/templates/codex/openai.toml ~/.codex/config.toml
Schritt 3: API-Key setzen lassen
| Anbieter | Umgebungsvariable | Bezugsquelle |
|---|---|---|
| GLM | ANTHROPIC_API_KEY (Claude Code) / GLM_API_KEY (Codex) | https://open.bigmodel.cn |
| OpenRouter | OPENROUTER_API_KEY | https://openrouter.ai |
| OpenAI | OPENAI_API_KEY | https://platform.openai.com |
| Anthropic | ANTHROPIC_API_KEY | https://console.anthropic.com |
echo 'export XXX_API_KEY="dein-key"' >> ~/.zshrc
source ~/.zshrc
Wichtige API-Endpunkte
| Verwendung | Endpunkt-URL |
|---|---|
| GLM Coding Plan (allgemein) | https://open.bigmodel.cn/api/coding/paas/v4 |
| GLM Coding Plan (Claude Code) | https://open.bigmodel.cn/api/anthropic |
| GLM Allgemeine API | https://open.bigmodel.cn/api/paas/v4 |
| OpenRouter | https://openrouter.ai/api/v1 |
| OpenAI | https://api.openai.com/v1 |
Modellzuordnung für Claude Code
Nach der GLM-Konfiguration werden Claude-Code-Modelle automatisch zugeordnet:
| Claude-Modellstufe | Standard-GLM-Modell |
|---|---|
| Opus | GLM-5.1 |
| Sonnet | GLM-5.1 |
| Haiku | GLM-4.5-Air |
Dies ist das Ergebnis der Konfiguration über glm-settings.json. Wenn diese Konfiguration nicht verwendet wird, lautet die Standardzuordnung: Opus→GLM-4.7, Sonnet→GLM-4.7, Haiku→GLM-4.5-Air.
Nach dem Start kannst du mit /status den aktuellen Modellstatus überprüfen.
Vorlagenverzeichnisstruktur
ai-config/
├── SKILL.md # Diese Datei
└── templates/
├── claude-code/
│ ├── glm.sh # Claude Code + GLM Umgebungsvariablen
│ ├── glm-settings.json # Claude Code + GLM Modellzuordnung
│ └── anthropic.sh # Claude Code + Anthropic Wiederherstellung
├── codex/
│ ├── glm.toml # Codex CLI + GLM
│ ├── openrouter.toml # Codex CLI + OpenRouter
│ └── openai.toml # Codex CLI + OpenAI
├── opencode/
│ ├── glm.json # OpenCode + GLM
│ └── openai.json # OpenCode + OpenAI
├── cline/
│ └── glm.md # Cline + GLM Konfigurationshinweise
└── openclaw/
└── glm.json # OpenClaw + GLM Konfigurationsfragment
Hinweise
- API-Key-Sicherheit: Gib API-Keys niemals in ein Git-Repository.
- GLM Coding Plan – spezifischer Endpunkt: Verwende zwingend
coding/paas/v4anstelle vonpaas/v4, da sonst kein Verbrauch des Tarifkontingents erfolgt. - Bestehende Claude-Benutzer: Falls die bestehende Konfiguration nicht überschrieben werden soll, verwende einen Alias:
alias glm-cc='ANTHROPIC_BASE_URL=https://open.bigmodel.cn/api/anthropic ANTHROPIC_API_KEY="dein-key" claude'. - Verfügbare GLM-Modelle: GLM-5.1, GLM-5, GLM-4.7, GLM-4.6, GLM-4.5, GLM-4.5-Air.
- Codex CLI – Konfigurationspriorität: Projektbezogene
.codex/config.tomlüberschreibt die globale~/.codex/config.toml.