Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问许可证需确认审计通过

cost-optimizer成本优化器

Agent Skill

cost-optimizer 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,420

周安装

61

GitHub Stars

98

下载量

498
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cost-optimizer(成本优化器)
来源仓库:https://github.com/erichowens/some_claude_skills
仓库路径:skills/cost-optimizer
安装命令:
npx skills add https://github.com/erichowens/some_claude_skills --skill cost-optimizer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/erichowens/some_claude_skills --skill cost-optimizer

简介

cost-optimizer 实时监控 DAG 执行中的 LLM 累计成本并动态调整策略。

  • 它可在预算范围内自动降级模型或跳过非关键节点以控制支出。
  • 适用于多代理工作流或高频调用 LLM 的应用场景。
  • 使用时需预设成本阈值与优先级规则以确保业务连续性。
  • 建议定期分析各节点开销分布以优化资源分配。cost-optimizer 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Cost Optimizer

Tracks cumulative LLM costs across DAG execution and makes real-time decisions to stay within budget: downgrade models, skip optional nodes, or stop early.


When to Use

Use for:

  • Setting and enforcing cost budgets for DAG executions
  • Real-time cost monitoring during execution
  • Deciding when to downgrade model tiers mid-execution
  • Identifying which nodes are most expensive and why
  • Post-execution cost analysis and optimization recommendations

NOT for:

  • Choosing which model to use per node (use llm-router)
  • Provider pricing comparisons (static data, not a skill)
  • Billing or invoicing features

Budget Enforcement Process

flowchart TD
  N[Node about to execute] --> C[Check: spent + estimated_node_cost vs budget]
  C --> S{Within budget?}
  S -->|Yes, >20% remaining| E[Execute at planned model tier]
  S -->|Yes, <20% remaining| W[Execute but downgrade to Tier 1 if possible]
  S -->|No| D{Node optional?}
  D -->|Yes| SK[Skip node]
  D -->|No| H{Human gate available?}
  H -->|Yes| A[Ask human: continue over budget?]
  H -->|No| ST[Stop execution, return partial results]

Budget Tiers

Budget RemainingAction
>50%Execute at planned model tier
20-50%Log warning. Continue at planned tier.
10-20%Downgrade remaining Tier 2 nodes to Tier 1 (Haiku)
5-10%Downgrade ALL remaining nodes to Tier 1. Skip optional nodes.
<5%Stop execution unless next node is critical path
0%Stop. Return partial results with cost breakdown.

Cost Estimation Per Node

Before each node executes, estimate its cost:

estimated_cost = (avg_input_tokens × input_price + avg_output_tokens × output_price)

Use historical averages for this skill + model combination. If no history, use defaults:

  • Tier 1 (Haiku): ~800 input + 400 output = ~$0.001
  • Tier 2 (Sonnet): ~2000 input + 1000 output = ~$0.012
  • Tier 3 (Opus): ~3000 input + 1500 output = ~$0.16

Post-Execution Report

cost_report:
  total_budget: 0.50
  total_spent: 0.37
  budget_remaining: 0.13
  nodes_executed: 8
  nodes_skipped: 1
  nodes_downgraded: 2
  model_breakdown:
    haiku: { calls: 4, cost: 0.004 }
    sonnet: { calls: 3, cost: 0.036 }
    opus: { calls: 1, cost: 0.33 }
  savings_recommendations:
    - "Node 'deep-analysis' used Opus ($0.33) but downstream accepted on first try. Try Sonnet next time — potential saving: $0.32"
    - "Nodes 'validate-a' and 'validate-b' are sequential but independent. Parallelize to reduce wall-clock time."

Anti-Patterns

No Budget at All

Wrong: Running DAGs without any cost tracking until the API bill arrives. Right: Every DAG execution has a budget, even if generous. Track spend per node.

Aggressive Downgrading

Wrong: Downgrading Opus nodes to Haiku at 50% budget remaining, causing quality failures that trigger expensive retries. Right: Only downgrade when the alternative is stopping execution. Retries cost more than the original model tier.

Ignoring Retries in Cost

Wrong: Budgeting for one attempt per node. Right: Budget for avg_retries × cost_per_attempt. A node with 3 retries on Sonnet costs $0.036, not $0.012.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.83%
按下载量换算188

Claude

28.38%
按下载量换算141

Cursor

19.48%
按下载量换算97

Gemini CLI

9.31%
按下载量换算46

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills