Files
skill-template/llm-manager/SKILL.md
2026-04-04 10:35:02 +08:00

120 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: 大模型管理器
description: 统一管理 AI 大模型的调用方式。优先通过账号网页版(免费)访问,无可用网页账号时自动降级到 API Key付费。支持豆包、DeepSeek、通义千问、Kimi、文心一言、腾讯元宝。
version: 1.0.3
author: 深圳匠厂科技有限公司
metadata:
openclaw:
slug: llm-manager
emoji: "🧠"
category: "通用"
dependencies:
required:
- account-manager
optional:
- openai # pip install openai仅 API Key 模式需要)
auto_install: false
allowed-tools:
- bash
disable: false
---
# 大模型管理器
## 使用方式
### 生成内容(核心命令)
```bash
# 指定平台名自动选择模式网页优先API Key 备用)
python3 {baseDir}/scripts/main.py generate kimi "帮我写一篇关于AI发展的文章"
python3 {baseDir}/scripts/main.py generate deepseek "帮我写一篇关于AI发展的文章"
python3 {baseDir}/scripts/main.py generate doubao "帮我写一篇关于AI发展的文章"
python3 {baseDir}/scripts/main.py generate qianwen "帮我写一篇关于AI发展的文章"
python3 {baseDir}/scripts/main.py generate yiyan "帮我写一篇关于AI发展的文章"
python3 {baseDir}/scripts/main.py generate yuanbao "帮我写一篇关于AI发展的文章"
# 指定 account_id强制使用该账号网页模式
python3 {baseDir}/scripts/main.py generate 3 "帮我写一篇关于AI发展的文章"
```
### 管理 API Key可选付费模式
```bash
# 添加 API Key
python3 {baseDir}/scripts/main.py key add deepseek "sk-xxx"
python3 {baseDir}/scripts/main.py key add kimi "sk-xxx" --model moonshot-v1-8k
python3 {baseDir}/scripts/main.py key add doubao "xxx" --model ep-xxx # 豆包须填 endpoint_id
# 查看
python3 {baseDir}/scripts/main.py key list
python3 {baseDir}/scripts/main.py key list deepseek
# 删除
python3 {baseDir}/scripts/main.py key del <key_id>
```
### 健康检查
```bash
python3 {baseDir}/scripts/main.py health
python3 {baseDir}/scripts/main.py version
```
## 调用模式选择逻辑
```
generate <target> "<prompt>"
├─ target 是数字account_id
│ └─ 强制网页模式(需该账号已在 account-manager 登录)
└─ target 是平台名
├─ 1. 查 account-manager有 login_status=1 的账号? → 网页模式(免费)
├─ 2. 查本地 llm_keys有 is_active=1 的 Key → API Key 模式(付费)
└─ 3. 都没有 → 报错,给出两种凭据的配置指引
```
## 使用网页模式的前提
网页模式依赖 **account-manager** 管理的账号和 Chrome Profile使用前需完成
```bash
# 1. 在 account-manager 中添加对应平台账号
python3 {accountManagerDir}/scripts/main.py add "Kimi" "手机号"
# 2. 登录(打开浏览器,手动完成登录后自动写入状态)
python3 {accountManagerDir}/scripts/main.py login <id>
```
## 环境变量
| 变量 | 说明 | 默认值 |
|---|---|---|
| `JIANGCHANG_DATA_ROOT` | 数据根目录(与 account-manager 一致) | Win: `D:\jiangchang-data` |
| `JIANGCHANG_USER_ID` | 用户/工作区 ID | `_anon` |
API Key 存储路径:`{JIANGCHANG_DATA_ROOT}/{JIANGCHANG_USER_ID}/llm-manager/llm-manager.db`
网页账号:通过 `account-manager` 子命令 `pick-logged-in` 查询,不直接读其数据库。
## 支持的平台
| 平台 | Slug | 中文别名 | 网页模式 | API 模式 |
|---|---|---|---|---|
| 豆包 | doubao | 豆包 | ✓ | ✓(火山方舟,需 ep-xxx |
| DeepSeek | deepseek | 深度求索 | ✓ | ✓ |
| 通义千问 | qianwen | 通义、千问 | ✓ | ✓ |
| Kimi | kimi | 月之暗面 | ✓ | ✓ |
| 文心一言 | yiyan | 文心、一言 | ✓ | ✓ |
| 腾讯元宝 | yuanbao | 元宝 | ✓ | ✗(暂无公开 API |
## 输出格式
generate 命令输出固定格式,方便下游 Skill如 sohu-publisher精确提取
```
===LLM_START===
(生成的内容)
===LLM_END===
```