mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-02-19 15:10:49 +08:00
init doc
This commit is contained in:
128
docs/i18n/zh-CN/docusaurus-plugin-content-docs/cli/model.md
Normal file
128
docs/i18n/zh-CN/docusaurus-plugin-content-docs/cli/model.md
Normal file
@@ -0,0 +1,128 @@
|
||||
---
|
||||
id: cli/model
|
||||
title: ccr model
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# ccr model
|
||||
|
||||
交互式模型选择和配置。
|
||||
|
||||
## 用法
|
||||
|
||||
```bash
|
||||
ccr model [命令]
|
||||
```
|
||||
|
||||
## 命令
|
||||
|
||||
### 选择模型
|
||||
|
||||
交互式选择模型:
|
||||
|
||||
```bash
|
||||
ccr model
|
||||
```
|
||||
|
||||
这将显示一个包含可用提供商和模型的交互式菜单。
|
||||
|
||||
### 设置默认模型
|
||||
|
||||
直接设置默认模型:
|
||||
|
||||
```bash
|
||||
ccr model set <provider>,<model>
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```bash
|
||||
ccr model set deepseek,deepseek-chat
|
||||
```
|
||||
|
||||
### 列出模型
|
||||
|
||||
列出所有配置的模型:
|
||||
|
||||
```bash
|
||||
ccr model list
|
||||
```
|
||||
|
||||
### 添加模型
|
||||
|
||||
添加新模型到配置:
|
||||
|
||||
```bash
|
||||
ccr model add <provider>,<model>
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```bash
|
||||
ccr model add groq,llama-3.3-70b-versatile
|
||||
```
|
||||
|
||||
### 删除模型
|
||||
|
||||
从配置中删除模型:
|
||||
|
||||
```bash
|
||||
ccr model remove <provider>,<model>
|
||||
```
|
||||
|
||||
## 示例
|
||||
|
||||
### 交互式选择
|
||||
|
||||
```bash
|
||||
$ ccr model
|
||||
|
||||
? 选择一个提供商: deepseek
|
||||
? 选择一个模型: deepseek-chat
|
||||
|
||||
默认模型设置为: deepseek,deepseek-chat
|
||||
```
|
||||
|
||||
### 直接配置
|
||||
|
||||
```bash
|
||||
ccr model set deepseek,deepseek-chat
|
||||
```
|
||||
|
||||
### 查看当前配置
|
||||
|
||||
```bash
|
||||
ccr model list
|
||||
```
|
||||
|
||||
输出:
|
||||
|
||||
```
|
||||
已配置的模型:
|
||||
deepseek,deepseek-chat (默认)
|
||||
groq,llama-3.3-70b-versatile
|
||||
gemini,gemini-2.5-pro
|
||||
```
|
||||
|
||||
## 交互式功能
|
||||
|
||||
`ccr model` 命令提供以下功能:
|
||||
|
||||
1. **查看当前配置**:查看所有已配置的模型和路由器设置
|
||||
2. **切换模型**:快速更改每个路由器类型使用的模型
|
||||
3. **添加新模型**:向现有提供商添加模型
|
||||
4. **创建新提供商**:设置完整的提供商配置,包括:
|
||||
- 提供商名称和 API 端点
|
||||
- API 密钥
|
||||
- 可用模型
|
||||
- 转换器配置,支持:
|
||||
- 多个转换器(openrouter、deepseek、gemini 等)
|
||||
- 转换器选项(例如,带自定义限制的 maxtoken)
|
||||
- 提供商特定路由(例如,OpenRouter 提供商偏好)
|
||||
|
||||
CLI 工具会验证所有输入并提供有用的提示来引导您完成配置过程,使管理复杂设置变得容易,无需手动编辑 JSON 文件。
|
||||
|
||||
## 相关命令
|
||||
|
||||
- [ccr start](/zh/docs/cli/start) - 启动服务器
|
||||
- [ccr config](/zh/docs/cli/other-commands#ccr-config) - 编辑配置
|
||||
@@ -0,0 +1,203 @@
|
||||
---
|
||||
id: cli/other-commands
|
||||
title: 其他命令
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# 其他命令
|
||||
|
||||
管理 Claude Code Router 的其他 CLI 命令。
|
||||
|
||||
## ccr stop
|
||||
|
||||
停止运行中的服务器。
|
||||
|
||||
```bash
|
||||
ccr stop
|
||||
```
|
||||
|
||||
## ccr restart
|
||||
|
||||
重启服务器。
|
||||
|
||||
```bash
|
||||
ccr restart
|
||||
```
|
||||
|
||||
## ccr code
|
||||
|
||||
通过路由器执行 claude 命令。
|
||||
|
||||
```bash
|
||||
ccr code [参数...]
|
||||
```
|
||||
|
||||
## ccr activate
|
||||
|
||||
输出 shell 环境变量以供集成使用。
|
||||
|
||||
```bash
|
||||
ccr activate
|
||||
```
|
||||
|
||||
输出:
|
||||
|
||||
```bash
|
||||
export ANTHROPIC_API_URL="http://localhost:3456/v1"
|
||||
export ANTHROPIC_API_KEY="sk-xxxxx"
|
||||
```
|
||||
|
||||
在 shell 中使用:
|
||||
|
||||
```bash
|
||||
eval "$(ccr activate)"
|
||||
```
|
||||
|
||||
`activate` 命令设置以下环境变量:
|
||||
|
||||
- `ANTHROPIC_AUTH_TOKEN`: 来自配置的 API 密钥
|
||||
- `ANTHROPIC_BASE_URL`: 本地路由器端点(默认:`http://127.0.0.1:3456`)
|
||||
- `NO_PROXY`: 设置为 `127.0.0.1` 以防止代理干扰
|
||||
- `DISABLE_TELEMETRY`: 禁用遥测
|
||||
- `DISABLE_COST_WARNINGS`: 禁用成本警告
|
||||
- `API_TIMEOUT_MS`: 来自配置的 API 超时时间
|
||||
|
||||
## ccr ui
|
||||
|
||||
在浏览器中打开 Web UI。
|
||||
|
||||
```bash
|
||||
ccr ui
|
||||
```
|
||||
|
||||
## ccr statusline
|
||||
|
||||
集成状态栏(从 stdin 读取 JSON)。
|
||||
|
||||
```bash
|
||||
echo '{"status":"running"}' | ccr statusline
|
||||
```
|
||||
|
||||
## ccr config
|
||||
|
||||
配置管理命令。
|
||||
|
||||
### 编辑配置
|
||||
|
||||
```bash
|
||||
ccr config edit
|
||||
```
|
||||
|
||||
在默认编辑器中打开配置文件。
|
||||
|
||||
### 验证配置
|
||||
|
||||
```bash
|
||||
ccr config validate
|
||||
```
|
||||
|
||||
验证当前配置文件。
|
||||
|
||||
### 显示配置
|
||||
|
||||
```bash
|
||||
ccr config show
|
||||
```
|
||||
|
||||
显示当前配置(敏感值已隐藏)。
|
||||
|
||||
## ccr preset
|
||||
|
||||
预设管理命令。
|
||||
|
||||
### 列出预设
|
||||
|
||||
```bash
|
||||
ccr preset list
|
||||
```
|
||||
|
||||
### 应用预设
|
||||
|
||||
```bash
|
||||
ccr preset apply <名称>
|
||||
```
|
||||
|
||||
### 保存预设
|
||||
|
||||
```bash
|
||||
ccr preset save <名称>
|
||||
```
|
||||
|
||||
保存当前配置为预设。
|
||||
|
||||
## ccr log
|
||||
|
||||
查看服务器日志。
|
||||
|
||||
```bash
|
||||
ccr log [选项]
|
||||
```
|
||||
|
||||
选项:
|
||||
- `-f, --follow`: 跟踪日志输出(类似 `tail -f`)
|
||||
- `-n <行数>`: 显示的行数
|
||||
|
||||
## 全局选项
|
||||
|
||||
这些选项可用于任何命令:
|
||||
|
||||
| 选项 | 说明 |
|
||||
|------|------|
|
||||
| `-h, --help` | 显示帮助 |
|
||||
| `-v, --version` | 显示版本号 |
|
||||
| `--config <路径>` | 配置文件路径 |
|
||||
| `--verbose` | 启用详细输出 |
|
||||
|
||||
## 示例
|
||||
|
||||
### 停止服务器
|
||||
|
||||
```bash
|
||||
ccr stop
|
||||
```
|
||||
|
||||
### 使用自定义配置重启
|
||||
|
||||
```bash
|
||||
ccr restart --config /path/to/config.json
|
||||
```
|
||||
|
||||
### 查看并设置环境变量
|
||||
|
||||
```bash
|
||||
eval "$(ccr activate)"
|
||||
```
|
||||
|
||||
### 打开 Web UI
|
||||
|
||||
```bash
|
||||
ccr ui
|
||||
```
|
||||
|
||||
### 跟踪日志
|
||||
|
||||
```bash
|
||||
ccr log -f
|
||||
```
|
||||
|
||||
### 列出可用预设
|
||||
|
||||
```bash
|
||||
ccr preset list
|
||||
```
|
||||
|
||||
### 应用预设
|
||||
|
||||
```bash
|
||||
ccr preset apply development
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [入门](/zh/docs/intro) - Claude Code Router 简介
|
||||
- [配置](/zh/docs/config/basic) - 配置指南
|
||||
83
docs/i18n/zh-CN/docusaurus-plugin-content-docs/cli/start.md
Normal file
83
docs/i18n/zh-CN/docusaurus-plugin-content-docs/cli/start.md
Normal file
@@ -0,0 +1,83 @@
|
||||
---
|
||||
id: cli/start
|
||||
title: ccr start
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# ccr start
|
||||
|
||||
启动 Claude Code Router 服务器。
|
||||
|
||||
## 用法
|
||||
|
||||
```bash
|
||||
ccr start [选项]
|
||||
```
|
||||
|
||||
## 选项
|
||||
|
||||
| 选项 | 别名 | 说明 |
|
||||
|------|------|------|
|
||||
| `--port <number>` | `-p` | 监听端口号(默认:3456) |
|
||||
| `--config <path>` | `-c` | 配置文件路径 |
|
||||
| `--daemon` | `-d` | 作为守护进程运行(后台进程) |
|
||||
| `--log-level <level>` | `-l` | 日志级别(fatal/error/warn/info/debug/trace) |
|
||||
|
||||
## 示例
|
||||
|
||||
### 使用默认设置启动
|
||||
|
||||
```bash
|
||||
ccr start
|
||||
```
|
||||
|
||||
### 在自定义端口启动
|
||||
|
||||
```bash
|
||||
ccr start --port 3000
|
||||
```
|
||||
|
||||
### 使用自定义配置启动
|
||||
|
||||
```bash
|
||||
ccr start --config /path/to/config.json
|
||||
```
|
||||
|
||||
### 作为守护进程启动
|
||||
|
||||
```bash
|
||||
ccr start --daemon
|
||||
```
|
||||
|
||||
### 启用调试日志
|
||||
|
||||
```bash
|
||||
ccr start --log-level debug
|
||||
```
|
||||
|
||||
## 环境变量
|
||||
|
||||
您也可以使用环境变量配置服务器:
|
||||
|
||||
| 变量 | 说明 |
|
||||
|------|------|
|
||||
| `PORT` | 监听端口号 |
|
||||
| `CONFIG_PATH` | 配置文件路径 |
|
||||
| `LOG_LEVEL` | 日志级别 |
|
||||
| `CUSTOM_ROUTER_PATH` | 自定义路由器函数路径 |
|
||||
| `HOST` | 绑定主机地址(默认:0.0.0.0) |
|
||||
|
||||
## 输出
|
||||
|
||||
启动成功后,您将看到:
|
||||
|
||||
```
|
||||
Claude Code Router is running on http://localhost:3456
|
||||
API endpoint: http://localhost:3456/v1
|
||||
```
|
||||
|
||||
## 相关命令
|
||||
|
||||
- [ccr stop](/zh/docs/cli/other-commands#ccr-stop) - 停止服务器
|
||||
- [ccr restart](/zh/docs/cli/other-commands#ccr-restart) - 重启服务器
|
||||
- [ccr status](/zh/docs/cli/other-commands#ccr-status) - 检查服务器状态
|
||||
64
docs/i18n/zh-CN/docusaurus-plugin-content-docs/cli/status.md
Normal file
64
docs/i18n/zh-CN/docusaurus-plugin-content-docs/cli/status.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
id: cli/status
|
||||
title: ccr status
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# ccr status
|
||||
|
||||
显示 Claude Code Router 服务器的当前状态。
|
||||
|
||||
## 用法
|
||||
|
||||
```bash
|
||||
ccr status
|
||||
```
|
||||
|
||||
## 输出
|
||||
|
||||
### 运行中的服务器
|
||||
|
||||
当服务器正在运行时:
|
||||
|
||||
```
|
||||
Claude Code Router 状态: 运行中
|
||||
版本: 2.0.0
|
||||
PID: 12345
|
||||
端口: 3456
|
||||
运行时间: 2小时34分钟
|
||||
配置: /home/user/.claude-code-router/config.json
|
||||
```
|
||||
|
||||
### 已停止的服务器
|
||||
|
||||
当服务器未运行时:
|
||||
|
||||
```
|
||||
Claude Code Router 状态: 已停止
|
||||
```
|
||||
|
||||
## 退出代码
|
||||
|
||||
| 代码 | 说明 |
|
||||
|------|------|
|
||||
| 0 | 服务器正在运行 |
|
||||
| 1 | 服务器已停止 |
|
||||
| 2 | 检查状态时出错 |
|
||||
|
||||
## 示例
|
||||
|
||||
```bash
|
||||
$ ccr status
|
||||
|
||||
Claude Code Router 状态: 运行中
|
||||
版本: 2.0.0
|
||||
PID: 12345
|
||||
端口: 3456
|
||||
运行时间: 2小时34分钟
|
||||
```
|
||||
|
||||
## 相关命令
|
||||
|
||||
- [ccr start](/zh/docs/cli/start) - 启动服务器
|
||||
- [ccr stop](/zh/docs/cli/other-commands#ccr-stop) - 停止服务器
|
||||
- [ccr restart](/zh/docs/cli/other-commands#ccr-restart) - 重启服务器
|
||||
Reference in New Issue
Block a user