- 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`.
Ver no GitHub