> 成本感知 LLM 管道,根据任务复杂度选择合适模型, 管理上下文预算,避免在长会话末尾做大型重构。
Scanned 9/12/2026
Install to Claude Code
npx -y skills add thedixitjain/the-mega-skill-library --skill cost-aware-llm-pipeline--hashgraph-online --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Cost Aware Llm Pipeline Hashgraph Online?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/thedixitjain-cost-aware-llm-pipeline-hashgraph-online)More formats (shields.io, HTML) on the badges page.
---
name: cost-aware-llm-pipeline
description: "> 成本感知 LLM 管道,根据任务复杂度选择合适模型, 管理上下文预算,避免在长会话末尾做大型重构。"
category: devops-and-infra
source_repo: hashgraph-online/awesome-codex-plugins
source_path: "plugins/Colin4k1024/tsp/skills/cost-aware-llm-pipeline/SKILL.md"
source_url: https://github.com/hashgraph-online/awesome-codex-plugins/blob/HEAD/plugins/Colin4k1024/tsp/skills/cost-aware-llm-pipeline/SKILL.md
---
# Cost-Aware LLM Pipeline Skill
成本感知 LLM 管道,根据任务复杂度选择合适模型,管理上下文预算。
## 何时激活
- 需要优化模型选择以控制成本
- 需要管理上下文使用预算
- 需要为不同复杂度任务选择合适模型
- 需要在长会话中避免上下文溢出
## 模型选择策略
### Haiku (轻量级)
**使用场景**:
- 简单任务:语法修正、格式化、小改动
- 频繁调用:grep、glob、文件探索
- 工具调用规划
**成本**: ~$0.001/1K tokens
### Sonnet (主开发)
**使用场景**:
- 主要开发工作
- 复杂编码任务
- 多文件重构
- 代码审查
**成本**: ~$0.01/1K tokens
### Opus (深度推理)
**使用场景**:
- 复杂架构决策
- 深度推理任务
- 新技术调研
- 关键问题调试
**成本**: ~$0.05/1K tokens
## 上下文预算管理
### 预算规则
| 上下文位置 | 可用空间 | 建议 |
|-----------|---------|------|
| 前 20% | 宽松 | 探索、研究、讨论 |
| 中间 60% | 谨慎 | 核心实现、详细代码 |
| 最后 20% | 压缩 | 整理、总结、收尾 |
### 避免的错误
- ❌ 在上下文最后 10% 做大型重构
- ❌ 在低上下文空间启动复杂任务
- ❌ 用 Opus 处理 Haiku 就能完成的任务
### 正确做法
- ✅ 在上下文中间启动复杂任务
- ✅ 在低空间使用 Haiku 做简单任务
- ✅ 定期压缩上下文避免溢出
## 任务复杂度分级
### L1: 简单(用 Haiku)
- 语法修正
- 文件格式化
- 简单搜索替换
- README 更新
### L2: 中等(用 Sonnet)
- 函数实现
- 单元测试编写
- 代码审查
- Bug 修复
### L3: 复杂(用 Sonnet 或 Opus)
- 多文件重构
- 架构设计
- 复杂调试
- 新模块设计
### L4: 深度(用 Opus)
- ADR 编写
- 架构决策
- 性能优化
- 跨系统设计
## 成本优化技巧
### 1. 批处理相似任务
```bash
# 不好:多次调用,每次都加载上下文
/edit file1.ts
/edit file2.ts
/edit file3.ts
# 好:一次调用处理多个文件
/multi-edit file1.ts file2.ts file3.ts
```
### 2. 使用上下文压缩
```
长会话后运行: /compact
保留决策和结论,丢弃中间追踪
```
### 3. 选择正确模型
```markdown
# 不好的做法
用 Opus 写 README
# 好的做法
用 Haiku 写 README
用 Sonnet 实现核心逻辑
用 Opus 做架构决策
```
## 与其他 Skills 的关系
| Skill | 关系 |
|-------|------|
| Strategic Compact | 提供上下文压缩以保持低使用率 |
| Continuous Learning | 从成本数据中学习优化模型选择 |
| Memory Persistence | 保存会话摘要以支持上下文重建 |
## 命令接入
- `/cost-estimate <task>` - 估算任务成本
- `/model-select <complexity>` - 建议模型选择
- `/context-budget` - 显示当前上下文预算
---
**Source:** [`hashgraph-online/awesome-codex-plugins`](https://github.com/hashgraph-online/awesome-codex-plugins) → `plugins/Colin4k1024/tsp/skills/cost-aware-llm-pipeline/SKILL.md`
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!