From 6d6ef3c31901da15689350a7faaf7c5b4b3c97f5 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Tue, 30 Jun 2026 08:07:09 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20GLM=20Coding=20Pla?= =?UTF-8?q?n=20=E7=AB=AF=E7=82=B9=E5=92=8C=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正端点为: https://api.z.ai/api/coding/paas/v4 - 验证 curl 直接调用成功 - 记录 Codex/Gemini CLI 不兼容问题 - 推荐直接使用 Claude Code + GLM-5.2 --- docs/design/02-design-v0.2.md | 75 +++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/docs/design/02-design-v0.2.md b/docs/design/02-design-v0.2.md index 547b362..0e5603c 100644 --- a/docs/design/02-design-v0.2.md +++ b/docs/design/02-design-v0.2.md @@ -85,8 +85,8 @@ CLAUDE.md 定好规则 → Superpowers 提供标准流程 → CCB 打通多模 | 组件 | Base URL | 环境变量 | |------|----------|---------| -| **Codex CLI** | `https://open.bigmodel.cn/api/paas/v4` | `OPENAI_API_BASE` | -| **Gemini CLI** | `https://open.bigmodel.cn/api/paas/v4` | `OPENROUTER_BASE_URL` | +| **Codex CLI** | `https://api.z.ai/api/coding/paas/v4` | `OPENAI_API_BASE` | +| **Gemini CLI** | `https://api.z.ai/api/coding/paas/v4` | `OPENROUTER_BASE_URL` | ### 3.3 API Key 配置 @@ -94,12 +94,12 @@ CLAUDE.md 定好规则 → Superpowers 提供标准流程 → CCB 打通多模 **环境变量**: ```bash -# Codex (GLM-5.2) -export OPENAI_API_BASE="https://open.bigmodel.cn/api/paas/v4" +# Codex (GLM Coding Plan) +export OPENAI_API_BASE="https://api.z.ai/api/coding/paas/v4" export OPENAI_API_KEY="你的智谱API_Key" -# Gemini (GLM-5.2) -export OPENROUTER_BASE_URL="https://open.bigmodel.cn/api/paas/v4" +# Gemini (GLM Coding Plan) +export OPENROUTER_BASE_URL="https://api.z.ai/api/coding/paas/v4" export OPENROUTER_API_KEY="你的智谱API_Key" ``` @@ -510,25 +510,21 @@ gotty -a 0.0.0.0 -p 8089 tmux attach -t sanguo_dev | 项目 | 状态 | 说明 | |------|------|------| -| **GLM-5.2 端点** | ✅ 正确 | `https://open.bigmodel.cn/api/paas/v4/chat/completions` | -| **API Key 有效性** | ⚠️ 余额不足 | 端点正确,Key 有效,但账户余额不足 | - -### 待充值 - -| Key | 状态 | -|-----|------| -| Codex Key (6903e8...) | ❌ 余额不足 | -| Gemini Key (4ae9f9...) | ❌ 余额不足 | +| **GLM Coding Plan 端点** | ✅ 正确且可用 | `https://api.z.ai/api/coding/paas/v4/chat/completions` | +| **API Key 有效性** | ✅ 有效 | Coding Plan Key 可正常调用 | ### 配置更新 -**GLM-5.2 正确端点**: +**GLM Coding Plan 正确端点**: ```bash -# Codex CLI -export OPENAI_API_BASE="https://open.bigmodel.cn/api/paas/v4" +# Codex CLI (OpenAI 兼容) +export OPENAI_API_BASE="https://api.z.ai/api/coding/paas/v4" -# Gemini CLI -export OPENROUTER_BASE_URL="https://open.bigmodel.cn/api/paas/v4" +# Gemini CLI (OpenAI 兼容) +export OPENROUTER_BASE_URL="https://api.z.ai/api/coding/paas/v4" + +# Claude Code (Anthropic 兼容) +export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic" ``` **ttyd 使用方式**: @@ -545,7 +541,44 @@ ttyd -p 8088 tmux attach -t sanguo_dev **最后更新**: 2026-06-30 **作者**: Claude Dev **审核状态**: 待审核 -**实施状态**: 环境准备完成 ✅ - 组件已安装,API 端点已验证,待充值测试 +**实施状态**: 环境准备完成 ⚠️ - GLM Coding Plan 端点验证成功,但 Codex/Gemini CLI 不兼容 + +## 14. GLM Coding Plan 兼容性说明 + +### 验证结果 + +| 组件 | 端点 | 状态 | 说明 | +|------|------|------|------| +| **curl 直接调用** | `https://api.z.ai/api/coding/paas/v4/chat/completions` | ✅ 成功 | 返回完整响应 | +| **Codex CLI** | 同上 | ❌ 失败 | 需要 `/responses` WebSocket 端点 | +| **Gemini CLI** | 同上 | ❌ 失败 | 使用 OpenRouter 格式,不兼容 | + +### 推荐方案 + +**直接使用 Claude Code + GLM-5.2**(无需 CCB 桥接): + +```json +// ~/.claude/settings.json +{ + "env": { + "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2[1m]", + "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2[1m]" + } +} +``` + +**Claude Code GLM-5.2 端点**: +- Anthropic 兼容:`https://api.z.ai/api/anthropic` +- 使用 1M 上下文:模型名称加 `[1m]` 后缀 + +### CCB 替代方案 + +如果仍需多 AI 协作,可考虑: +1. 使用支持 OpenAI 标准格式的其他 CLI 工具 +2. 直接通过 HTTP API 调用 GLM-5.2 +3. 等待 Codex/Gemini CLI 支持更多端点格式 **文档版本**: v0.2 **最后更新**: 2026-06-29