> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensorcost.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Estimate and compare prompt costs, list model prices and audit an AI invoice from the command line.

`@tensorcost/cli` runs on your machine and takes no API key. Use it to price a prompt before you ship it, or to check an invoice against a usage export before you connect anything. It needs Node.js 18 or later.

```bash theme={null}
npm install -g @tensorcost/cli
# or run without installing
npx @tensorcost/cli estimate --prompt "Hello" --model openai/gpt-4o
```

Both `tensorcost` and `tc` work as the command name.

## Commands

| Command | What it does |
| - | - |
| `estimate` | Estimates the cost of one prompt on one model, or on every model of a provider |
| `compare` | Compares the cost of a baseline prompt and a candidate prompt |
| `models` | Lists models with list prices in dollars per million tokens |
| `audit` | Reads a usage export and an invoice, and prints five figures a provider's dashboard does not show |

### estimate

```bash theme={null}
tensorcost estimate \
  --prompt-file prompts/rerank.txt \
  --model anthropic/claude-3-haiku \
  --calls-per-day 5000
```

| Flag | Meaning |
| - | - |
| `--prompt <text>`, `--prompt-file <path>` | The prompt |
| `--model <id>` | A model id such as `openai/gpt-4o`; run `models` to see them |
| `--provider <name>` | Estimate the same prompt across every model of a provider |
| `--expected-output-tokens <n>` | Override the output estimate. The default is the larger of 64 and a fifth of the input. |
| `--calls-per-day <n>` | Also print a monthly projection |
| `--json` | Machine-readable output |

Tokens are estimated at one per four characters, which is within about 10 percent for typical English text.

### compare

```bash theme={null}
tensorcost compare \
  --baseline-file prompts/v1.txt \
  --candidate-file prompts/v2.txt \
  --model openai/gpt-4o
```

`--baseline` and `--candidate` take inline text instead of files. `--model` is required. `--expected-output-tokens` and `--json` work as in `estimate`.

### models

```bash theme={null}
tensorcost models --provider anthropic
```

`--provider` filters; `--json` prints the whole catalogue; `--include-legacy` shows deprecated models.

### audit

```bash theme={null}
tensorcost audit openai=openai.csv anthropic=anthropic.csv \
  --invoice openai=1842.00 --invoice anthropic=invoice.csv
```

`audit` makes no network calls and your files go nowhere. It reads provider usage exports (any usage CSV with a cost column, GitHub Copilot, Claude Team and Enterprise, Claude Code, Cursor) and your invoice total, and prints the largest single run and its share of spend, spend with no owner, the price paid against list, the share of spend that carries a project, team or cost-centre tag, and cost per attempt. `--invoice` takes an amount or a text or CSV file; PDFs are not read, so pass the total. `--window 30|90` records the days the export covers and does not filter the file. `--json` prints the full audit.

## Prices

The CLI ships with a small price list and, when online, refreshes it from a public snapshot on `console.tensorcost.com`, cached for an hour. Set `TENSORCOST_OFFLINE=1` to skip the network and use the bundled list. The prices are public list prices, so the CLI shows what a model costs at list, not what your contract charges.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.