agent-cost
Estimate the cost of the current coding task with the agent-cost CLI. Use when a user asks what an agent run may cost, which configured model is the balanced choice, or invokes /agent-cost before starting coding work.
来源信息
- 仓库
- devinat1/agent-cost
- 最近来源活动
- 2026年7月11日 16:11
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 0
- 分支
- 0
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
文件资源管理器
2 个文件正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- agent-cost
- description
- Estimate the cost of the current coding task with the agent-cost CLI. Use when a user asks what an agent run may cost, which configured model is the balanced choice, or invokes /agent-cost before starting coding work.
# Agent Cost
Infer the concrete coding task from the current conversation and estimate it in the current Git repository. Ask for task text only when the conversation does not contain a concrete task.
## Run the estimate
1. Confirm the workspace is a Git repository and `git ls-files` returns at least one file. Stop clearly if either check fails. Never add untracked content to the estimate.
2. Check `node --version` is at least 22.12 and `npm --version` succeeds. If not, stop and direct the user to install a current Node.js LTS release from nodejs.org; do not install Node or npm.
3. If the `agent-cost` executable is unavailable, run:
```sh
npm install --global @devinat1/agent-cost
```
4. Use the current workspace as `--repo`. Pass the inferred task as one argument without interpolating it into shell syntax. Prefer an argv-capable execution tool; otherwise write it to a secure temporary file with platform APIs, pass `--task @<path>`, and delete the file afterward.
5. Use a user-provided budget override when present; otherwise use `0.50`. Run:
```sh
agent-cost preflight --repo <workspace> --task <task-or-@file> --probe-budget <budget> --yes --json
```
6. If the command reports that no profile exists, run `agent-cost profile` in an interactive terminal. This securely prompts for a missing OpenRouter key, saves it in the user config directory, and launches model/access setup. Then rerun the preflight once.
Invoking this skill authorizes the bounded paid preflight and transmission of the CLI's displayed Git-tracked context through OpenRouter. Do not ask for another confirmation. Never print, echo, read back, or place the API key in a repository.
## Return the result
Read the final JSON result. Find `recommendations.balanced`, then the matching entry in `models`. Return only:
- model ID and its configured access path or paths;
- predicted `costUsd.low`–`costUsd.high` range;
- confidence.
If no balanced model exists or the command fails, return one short cause and the next action. Do not run `record` or `history`.
在 GitHub 查看