docs: 添加GLM-5.2配置方案调研

This commit is contained in:
2026-06-29 20:09:58 +08:00
parent 95555e2828
commit 1cdaba9c85
@@ -318,4 +318,120 @@ Active backends: codex, gemini, claude
---
## 十一、GLM-5.2 配置方案(补充调研)
### 11.1 智谱 AI GLM-5.2 概述
**模型信息**:
- 模型名称: `glm-5.2`
- 上下文长度: 1M token100万)
- 发布时间: 2026-06-13
- 特色: 长程 Coding Agent 场景优化
**OpenAI 兼容端点**:
```bash
base_url: https://api.zhipuai.cn/v1
```
### 11.2 Codex CLI 配置 GLM-5.2
**方案一:通过 config.toml 配置**
编辑 `~/.codex/config.toml`:
```toml
[profile.default]
openai_base_url = "https://api.zhipuai.cn/v1"
model = "glm-5.2"
```
设置 API Key:
```bash
export OPENAI_API_KEY="你的智谱API_Key"
```
**方案二:通过环境变量(更简单)**
```bash
export OPENAI_API_BASE="https://api.zhipuai.cn/v1"
export OPENAI_API_KEY="你的智谱API_Key"
```
**验证配置**:
```bash
codex --version
codex "测试"
```
### 11.3 Gemini CLI 配置 GLM-5.2
**根据智谱 AI 官方文档,需要使用定制版 Gemini CLI**
#### 获取定制版本
```bash
git clone https://github.com/heartyguy/gemini-cli
cd gemini-cli
git checkout feature/openrouter-support
```
#### 环境配置
**配置 API 基础 URL**:
```bash
export OPENROUTER_BASE_URL="https://open.bigmodel.cn/api/coding/paas/v4"
```
**配置 API Key**:
```bash
export OPENROUTER_API_KEY="你的智谱API_Key"
```
#### 系统要求
- Node.js 版本 >= 18
#### 完整配置示例
```bash
# 1. 克隆定制版本
git clone https://github.com/heartyguy/gemini-cli
cd gemini-cli
git checkout feature/openrouter-support
# 2. 安装依赖
npm install
# 3. 设置环境变量
export OPENROUTER_BASE_URL="https://open.bigmodel.cn/api/coding/paas/v4"
export OPENROUTER_API_KEY="你的智谱API_Key"
# 4. 启动
npm start
```
---
## 十二、配置总结
### 12.1 两个 CLI 都可以配置 GLM-5.2
| CLI | 配置方式 | Base URL |
|-----|---------|----------|
| **Codex CLI** | config.toml 或环境变量 | `https://api.zhipuai.cn/v1` |
| **Gemini CLI** | 定制版本 + 环境变量 | `https://open.bigmodel.cn/api/coding/paas/v4` |
### 12.2 API Key 格式
智谱 AI 的 API Key 格式:
```
xxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxx
```
### 12.3 模型名称
```
glm-5.2
```
---
**报告结束**