docs: 添加中文 README,SKILL.md 全部改为中文描述
This commit is contained in:
@@ -0,0 +1,69 @@
|
|||||||
|
# openclaw-trapi-config
|
||||||
|
|
||||||
|
OpenClaw 技能(Skill):配置传米科技 trapi 自定义 Provider 及模型。
|
||||||
|
|
||||||
|
## 简介
|
||||||
|
|
||||||
|
trapi 是传米科技(Transiglobal)提供的大模型中转 API 服务,统一使用 Anthropic Messages 格式。本技能帮助用户在任意 OpenClaw 实例上一键配置 trapi Provider,包含预置模型和别名,并支持动态添加新模型。
|
||||||
|
|
||||||
|
## 服务信息
|
||||||
|
|
||||||
|
| 项目 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| Provider 名称 | `trapi` |
|
||||||
|
| API 地址 | `https://lapi.transiglobal.com` |
|
||||||
|
| API 格式 | `anthropic-messages` |
|
||||||
|
| 运营方 | 传米科技 |
|
||||||
|
|
||||||
|
## 预置模型
|
||||||
|
|
||||||
|
| 模型 ID | 别名 | 输入类型 | 上下文窗口 | 最大输出 |
|
||||||
|
|---------|------|---------|-----------|---------|
|
||||||
|
| GLM-5-Turbo | `glm5t` | 文本 | 200K | 64K |
|
||||||
|
| GLM-5.1 | `glm51` | 文本 | 200K | 64K |
|
||||||
|
| MiniMax-M2.7 | `mxm27` | 文本 | 200K | 64K |
|
||||||
|
| K2.6-code-preview | `kimi` | 文本 + 图片 | 200K | 64K |
|
||||||
|
|
||||||
|
## 使用方式
|
||||||
|
|
||||||
|
### 安装技能
|
||||||
|
|
||||||
|
将 `openclaw-trapi-config.skill` 文件放到 OpenClaw 的 skills 目录下,或通过以下命令安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
openclaw skill install openclaw-trapi-config.skill
|
||||||
|
```
|
||||||
|
|
||||||
|
### 首次配置 trapi
|
||||||
|
|
||||||
|
在 OpenClaw 对话中说:
|
||||||
|
|
||||||
|
> "配置 trapi"
|
||||||
|
|
||||||
|
技能会引导你完成:
|
||||||
|
1. **提供 API Key**(必须提供,不会使用任何默认 key)
|
||||||
|
2. **自动写入 Provider 配置**到 `openclaw.json`
|
||||||
|
3. **注册模型别名**(glm5t / glm51 / mxm27 / kimi)
|
||||||
|
4. **逐个模型验证**,确保连通性
|
||||||
|
|
||||||
|
### 添加新模型
|
||||||
|
|
||||||
|
当 trapi 已配置好后,说:
|
||||||
|
|
||||||
|
> "给 trapi 添加 Qwen-3-Plus"
|
||||||
|
|
||||||
|
技能会:
|
||||||
|
1. 询问模型全称
|
||||||
|
2. 自动生成 ≤5 字符的别名(避免与已有别名冲突)
|
||||||
|
3. 默认 200K 上下文 / 64K 最大输出,支持自定义
|
||||||
|
4. 写入配置并验证
|
||||||
|
|
||||||
|
## 安全说明
|
||||||
|
|
||||||
|
- **API Key 必须由用户提供**,技能中不存储任何默认密钥
|
||||||
|
- 未提供 Key 时配置流程会立即终止
|
||||||
|
- 所有配置通过 OpenClaw 标准的 `gateway config.patch` 写入
|
||||||
|
|
||||||
|
## 许可证
|
||||||
|
|
||||||
|
MIT
|
||||||
@@ -1,43 +1,37 @@
|
|||||||
---
|
---
|
||||||
name: openclaw-trapi-config
|
name: openclaw-trapi-config
|
||||||
description: |
|
description: |
|
||||||
Configure Transiglobal's "trapi" custom provider and models in OpenClaw. Guides users through adding the provider, required models, and aliases to openclaw.json. Also supports dynamically adding new models to an existing trapi provider. Triggers on phrases like "配置 trapi", "安装 trapi", "添加 trapi provider", "trapi 配置", "Transiglobal API", "配置传米 API", "trapi 添加模型", "trapi add model", or when setting up GLM-5-Turbo / GLM-5.1 / MiniMax-M2.7 / K2.6-code-preview via the trapi provider. Use when a user wants to add the Transiglobal relay API (lapi.transiglobal.com) as a model provider, or add new models to an existing trapi provider.
|
配置传米科技 trapi 自定义 Provider 及模型。引导用户将 trapi Provider(lapi.transiglobal.com)添加到 OpenClaw,支持首次安装和动态添加新模型。触发词:"配置 trapi"、"安装 trapi"、"添加 trapi provider"、"trapi 配置"、"Transiglobal API"、"配置传米 API"、"trapi 添加模型"、"trapi add model",或涉及 GLM-5-Turbo / GLM-5.1 / MiniMax-M2.7 / K2.6-code-preview 的 trapi 配置。也可在 trapi 已存在时用于添加新模型。
|
||||||
---
|
---
|
||||||
|
|
||||||
# Transiglobal API (trapi) Provider Configuration
|
# trapi Provider 配置指南
|
||||||
|
|
||||||
Configure the `trapi` custom provider with Anthropic Messages API format on any OpenClaw instance.
|
在任意 OpenClaw 实例上配置 `trapi` 自定义 Provider,使用 Anthropic Messages API 格式。
|
||||||
|
|
||||||
## Provider Info
|
## 服务信息
|
||||||
|
|
||||||
- **Provider name**: `trapi`
|
- **Provider 名称**:`trapi`
|
||||||
- **Base URL**: `https://lapi.transiglobal.com`
|
- **Base URL**:`https://lapi.transiglobal.com`
|
||||||
- **API format**: `anthropic-messages`
|
- **API 格式**:`anthropic-messages`
|
||||||
- **Owner**: 传米科技 (Transiglobal)
|
- **运营方**:传米科技(Transiglobal)
|
||||||
|
|
||||||
## Prerequisites
|
## 前置条件
|
||||||
|
|
||||||
1. User **must provide their own API key** — never use a default or hardcoded key
|
1. 用户**必须提供自己的 API Key** —— 绝不使用默认或硬编码的密钥
|
||||||
2. If user does not provide an API key, **stop immediately** and ask for it; do not proceed without one
|
2. 如用户未提供 API Key,**立即停止**并要求提供;不可继续执行
|
||||||
3. OpenClaw must be installed and running on the target machine
|
3. OpenClaw 必须已安装并运行
|
||||||
|
|
||||||
## Step 1: Ask for API Key
|
## 步骤 1:要求 API Key
|
||||||
|
|
||||||
Before any configuration, ask the user for their `trapi` API key. Acceptable formats:
|
进行任何配置前,先向用户索要 `trapi` API Key。接受形式:
|
||||||
- Direct paste of the key string
|
- 直接粘贴 Key 字符串
|
||||||
- Key from environment variable (if the user prefers)
|
- 通过环境变量引用
|
||||||
|
|
||||||
If the user declines or fails to provide a key, end the workflow with a clear message: *"trapi provider 配置需要 API key,未提供无法继续。请获取 key 后重新运行。"*
|
如用户拒绝或无法提供,以明确信息终止流程:*"trapi provider 配置需要 API Key,未提供无法继续。请获取 Key 后重新运行。"*
|
||||||
|
|
||||||
## Step 2: Configure Provider
|
## 步骤 2:配置 Provider
|
||||||
|
|
||||||
Use `gateway config.patch` to add the `trapi` provider to `models.providers`. The patch targets:
|
使用 `gateway config.patch` 将 `trapi` provider 添加到 `models.providers`。
|
||||||
|
|
||||||
```
|
|
||||||
models.providers.trapi
|
|
||||||
```
|
|
||||||
|
|
||||||
Patch JSON:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -45,7 +39,7 @@ Patch JSON:
|
|||||||
"providers": {
|
"providers": {
|
||||||
"trapi": {
|
"trapi": {
|
||||||
"baseUrl": "https://lapi.transiglobal.com",
|
"baseUrl": "https://lapi.transiglobal.com",
|
||||||
"apiKey": "<USER_PROVIDED_API_KEY>",
|
"apiKey": "<用户提供的API_KEY>",
|
||||||
"api": "anthropic-messages",
|
"api": "anthropic-messages",
|
||||||
"models": [
|
"models": [
|
||||||
{
|
{
|
||||||
@@ -95,9 +89,9 @@ Patch JSON:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Step 3: Configure Model Aliases
|
## 步骤 3:配置模型别名
|
||||||
|
|
||||||
Use `gateway config.patch` to add aliases under `agents.defaults.models`:
|
使用 `gateway config.patch` 添加别名到 `agents.defaults.models`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -114,105 +108,103 @@ Use `gateway config.patch` to add aliases under `agents.defaults.models`:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Step 4: Apply and Restart
|
## 步骤 4:应用配置
|
||||||
|
|
||||||
Use `gateway config.patch` with `note` parameter to describe what was done. The gateway will hot-reload or restart automatically.
|
使用 `gateway config.patch` 并附带 `note` 参数说明变更内容。Gateway 会自动热加载或重启。
|
||||||
|
|
||||||
If patch is not available, fallback to `gateway config.apply` with the full config.
|
## 步骤 5:逐个验证模型
|
||||||
|
|
||||||
## Step 5: Validate Each Model
|
配置生效后,使用 subagent 逐个验证 4 个模型:
|
||||||
|
|
||||||
After configuration is applied, validate all 4 models using subagent calls. Spawn a subagent for each model with a simple test prompt:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
sessions_spawn(
|
sessions_spawn(
|
||||||
model: "trapi/<MODEL_ID>",
|
model: "trapi/<模型ID>",
|
||||||
task: "Reply with exactly: OK",
|
task: "Reply with exactly: OK",
|
||||||
runtime: "subagent"
|
runtime: "subagent"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Validate in order:
|
验证顺序:
|
||||||
1. `trapi/GLM-5-Turbo` (alias: glm5t)
|
1. `trapi/GLM-5-Turbo`(别名:glm5t)
|
||||||
2. `trapi/GLM-5.1` (alias: glm51)
|
2. `trapi/GLM-5.1`(别名:glm51)
|
||||||
3. `trapi/MiniMax-M2.7` (alias: mxm27)
|
3. `trapi/MiniMax-M2.7`(别名:mxm27)
|
||||||
4. `trapi/K2.6-code-preview` (alias: kimi)
|
4. `trapi/K2.6-code-preview`(别名:kimi)
|
||||||
|
|
||||||
### Validation Criteria
|
### 验证标准
|
||||||
|
|
||||||
For each model, the validation passes if:
|
每个模型验证通过的条件:
|
||||||
- The subagent returns a response (not an error/timeout)
|
- subagent 返回正常响应(非错误/超时)
|
||||||
- The response contains text output
|
- 响应包含文本输出
|
||||||
|
|
||||||
### Validation Report
|
### 验证报告
|
||||||
|
|
||||||
After all validations, provide a summary:
|
所有模型验证完成后,输出汇总表:
|
||||||
|
|
||||||
| Model | Alias | Status |
|
| 模型 | 别名 | 状态 |
|
||||||
|-------|-------|--------|
|
|------|------|------|
|
||||||
| GLM-5-Turbo | glm5t | ✅/❌ |
|
| GLM-5-Turbo | glm5t | ✅/❌ |
|
||||||
| GLM-5.1 | glm51 | ✅/❌ |
|
| GLM-5.1 | glm51 | ✅/❌ |
|
||||||
| MiniMax-M2.7 | mxm27 | ✅/❌ |
|
| MiniMax-M2.7 | mxm27 | ✅/❌ |
|
||||||
| K2.6-code-preview | kimi | ✅/❌ |
|
| K2.6-code-preview | kimi | ✅/❌ |
|
||||||
|
|
||||||
## Add New Model (trapi already configured)
|
## 添加新模型(trapi 已配置时)
|
||||||
|
|
||||||
Use this flow when `trapi` provider already exists and user wants to add one or more new models.
|
当 trapi Provider 已存在,用户需要添加新模型时使用此流程。
|
||||||
|
|
||||||
### Required from User
|
### 用户需提供的信息
|
||||||
|
|
||||||
| Field | Required | Default |
|
| 字段 | 是否必填 | 默认值 |
|
||||||
|-------|----------|---------|
|
|------|---------|--------|
|
||||||
| Model ID (full name) | ✅ Yes | — |
|
| 模型 ID(全称) | ✅ 必填 | — |
|
||||||
| contextWindow | No | 200000 (200K) |
|
| contextWindow | 选填 | 200000(200K) |
|
||||||
| maxTokens | No | 64000 (64K) |
|
| maxTokens | 选填 | 64000(64K) |
|
||||||
| input types | No | `["text"]` (can add `"image"`) |
|
| input 类型 | 选填 | `["text"]`(可加 `"image"`) |
|
||||||
|
|
||||||
### Alias Generation Rules
|
### 别名生成规则
|
||||||
|
|
||||||
Generate alias **≤ 5 characters**, following these priorities:
|
生成 **≤ 5 字符**的别名,按以下优先级:
|
||||||
|
|
||||||
1. **Known patterns** — derive from common abbreviations:
|
1. **已知模式** — 从常见缩写推导:
|
||||||
- `GLM-` → `glm`, `MiniMax-` → `mxm`, `K2.6` → `kimi`, `mimo` → `mimo`
|
- `GLM-` → `glm`,`MiniMax-` → `mxm`,`K2.6` → `kimi`,`mimo` → `mimo`
|
||||||
2. **Remove separators** — strip `-`, `.`, spaces: `GLM-5-Turbo` → `GLM5Turbo`
|
2. **去除分隔符** — 去掉 `-`、`.`、空格:`GLM-5-Turbo` → `GLM5Turbo`
|
||||||
3. **Take first 5 chars** of the cleaned string: `GLM5T`
|
3. **取前 5 字符**:`GLM5T`
|
||||||
4. **Lowercase** the result: `glm5t`
|
4. **转小写**:`glm5t`
|
||||||
5. **If conflict** with existing alias, append a digit suffix: `glm5t2`
|
5. **冲突处理**:如与已有别名冲突,追加数字后缀:`glm5t2`
|
||||||
|
|
||||||
### Existing Aliases (must not duplicate)
|
### 已有别名(不可重复)
|
||||||
|
|
||||||
| Model | Alias |
|
| 模型 | 别名 |
|
||||||
|-------|-------|
|
|------|------|
|
||||||
| GLM-5-Turbo | glm5t |
|
| GLM-5-Turbo | glm5t |
|
||||||
| GLM-5.1 | glm51 |
|
| GLM-5.1 | glm51 |
|
||||||
| MiniMax-M2.7 | mxm27 |
|
| MiniMax-M2.7 | mxm27 |
|
||||||
| K2.6-code-preview | kimi |
|
| K2.6-code-preview | kimi |
|
||||||
|
|
||||||
### Flow
|
### 操作流程
|
||||||
|
|
||||||
1. Ask user for **model ID** (full name)
|
1. 向用户询问**模型 ID**(全称)
|
||||||
2. Ask if they want to customize contextWindow, maxTokens, or input types
|
2. 询问是否需要自定义 contextWindow、maxTokens 或 input 类型
|
||||||
3. Generate alias using rules above
|
3. 按上述规则生成别名
|
||||||
4. Show user the proposed config and ask for confirmation
|
4. 向用户展示拟配置方案并确认
|
||||||
5. Use `gateway config.patch` to add model to `models.providers.trapi.models` array
|
5. `gateway config.patch` 添加模型到 `models.providers.trapi.models`
|
||||||
6. Use `gateway config.patch` to add alias to `agents.defaults.models`
|
6. `gateway config.patch` 添加别名到 `agents.defaults.models`
|
||||||
7. Validate with subagent: `sessions_spawn(model: "trapi/<MODEL_ID>", task: "Reply with exactly: OK", runtime: "subagent")`
|
7. subagent 验证:`sessions_spawn(model: "trapi/<模型ID>", task: "Reply with exactly: OK", runtime: "subagent")`
|
||||||
8. Report result
|
8. 报告结果
|
||||||
|
|
||||||
### Example: Adding "Qwen-3-Plus"
|
### 示例:添加 "Qwen-3-Plus"
|
||||||
|
|
||||||
User says: "给 trapi 加一个 Qwen-3-Plus"
|
用户说:"给 trapi 加一个 Qwen-3-Plus"
|
||||||
|
|
||||||
1. Model ID: `Qwen-3-Plus`
|
1. 模型 ID:`Qwen-3-Plus`
|
||||||
2. Defaults: contextWindow 200K, maxTokens 64K, input `["text"]`
|
2. 默认参数:contextWindow 200K,maxTokens 64K,input `["text"]`
|
||||||
3. Alias: clean `Qwen3Plus` → `qwen3` (no conflict) → alias: `qwen3`
|
3. 别名:清理为 `Qwen3Plus` → `qwen3`(无冲突)→ 别名:`qwen3`
|
||||||
4. Patch model into `trapi.models`, alias into `agents.defaults.models`
|
4. Patch 模型到 `trapi.models`,别名到 `agents.defaults.models`
|
||||||
5. Validate
|
5. 验证
|
||||||
|
|
||||||
## Troubleshooting
|
## 故障排查
|
||||||
|
|
||||||
- **401/403**: API key invalid or expired — ask user to verify
|
- **401/403**:API Key 无效或过期 — 请用户核实
|
||||||
- **Connection timeout**: Check network access to `lapi.transiglobal.com`
|
- **连接超时**:检查到 `lapi.transiglobal.com` 的网络连通性
|
||||||
- **Model not found**: The model ID may have changed — check with Transiglobal
|
- **Model not found**:模型 ID 可能已变更 — 联系传米科技确认
|
||||||
- **config.patch conflict**: If `trapi` provider already exists, patch will merge; if aliases conflict, warn user
|
- **config.patch 冲突**:trapi provider 已存在时 patch 会合并;别名冲突时警告用户
|
||||||
- **Alias conflict**: Regenerate with numeric suffix and confirm with user
|
- **别名冲突**:重新生成带数字后缀的别名并与用户确认
|
||||||
|
|||||||
Reference in New Issue
Block a user