You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 99bbbba
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(cli): rename --mode api-equiv to --mode api
`api-equiv` was a wordy spelling of the same concept. The shorter
`api` reads better in CLI help, in docs, and at the command line,
and there's no naming conflict to defend against now that
`--mode credits` has been removed.
Note for Copilot specifically: `auto` is GitHub's bill against your
allotment (AI Credits × $0.01, or premium-request × $0.04 for
pre-cutover sessions). `api` is the *hypothetical* equivalent of
calling Anthropic / OpenAI / Google directly at LiteLLM token
pricing — useful for justifying the Copilot subscription.
Changes:
- `ccusage-cli/src/parser.rs`: accept `"api"` instead of
`"api-equiv"`; updated tests now reject the old spelling
(`parse_cost_mode("api-equiv")` returns an error).
- `ccusage-cli/src/cli-help.json` and `help_codegen.rs`: rename in
the `--mode` choices list rendered in `--help`.
- `config_schema.rs`: rename `ConfigCostMode::ApiEquiv` to
`Api`, drop the explicit serde rename so it surfaces as `"api"`
via the enum's `rename_all = "lowercase"`.
- `config.rs`: updated `From<ConfigCostMode>` arm.
- `adapter/copilot/loader.rs`: comment updates only (`Calculate /
api` in the dispatch table and inline comments).
- Regenerated JSON schemas (`apps/ccusage/config-schema.json` and
the gitignored `docs/public/config-schema.json` mirror) and
accepted the schema snapshot diff (only the literal `"api-equiv"`
→ `"api"` swap in each occurrence).
- Docs: `docs/guide/copilot/index.md`,
`docs/guide/cost-modes.md`, `docs/guide/cli-options.md`, and
the adapter README all updated to use `api` instead of
`api-equiv`.
Verified: 327 workspace tests pass. `./target/release/ccusage
copilot daily --mode api --json --offline` returns 74 days /
$7,561.16 (api-equivalent), confirming the alias still routes to
the same `Calculate` code path. `--mode api-equiv` is now
rejected with "Invalid cost mode 'api-equiv'".
Refs ccusage#1174
Co-authored-by: Copilot <[email protected]>
Copy file name to clipboardExpand all lines: docs/guide/copilot/index.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,13 +51,13 @@ These views support `--json` for structured output, `--compact` for narrow termi
51
51
52
52
## Pricing modes
53
53
54
-
`ccusage copilot` supports the standard cost modes plus an `api-equiv` discoverability alias. For Copilot, the modes map to billing realities as follows:
54
+
`ccusage copilot` supports the standard cost modes plus an `api` discoverability alias. For Copilot, the modes map to billing realities as follows:
55
55
56
56
| Mode | What it shows for Copilot |
57
57
|---|---|
58
58
|`auto` (default) |**True bill, era-aware**: AI Credits for post-cutover sessions (CLI ≥ 1.0.40), premium-request × $0.04 for pre-cutover sessions, token-priced for sessions with neither billing field |
59
59
|`display`| Source-precomputed only: AI Credits → premium-requests → `$0.00`. No token-priced fallback |
60
-
|`calculate` / `api-equiv`| Always LiteLLM token pricing — what the same usage would have cost via the underlying provider's API |
60
+
|`calculate` / `api`| Always LiteLLM token pricing — what the same usage would have cost via the underlying provider's API |
61
61
62
62
Why era-aware? GitHub Copilot switched billing models on June 1, 2026: pre-cutover sessions were billed as "premium requests" with per-model multipliers at $0.04 per overage request; post-cutover sessions bill as AI Credits at $0.01 per credit. The Copilot CLI records each session's own billing data, so `auto` reports what GitHub actually charged you for that session — whichever era it belongs to.
63
63
@@ -67,7 +67,7 @@ ccusage copilot daily
67
67
68
68
# API-equivalent: what direct Anthropic/OpenAI/Google calls would have cost.
@@ -85,7 +85,7 @@ See [Cost Modes](/guide/cost-modes) for the full mode reference.
85
85
-**Cache tokens** — cache read and cache creation tokens are counted from the source's `cacheReadTokens` / `cacheWriteTokens` fields.
86
86
-**Reasoning tokens** — provider-dependent. For OpenAI (`gpt-*`) and Anthropic (`claude-*`) models reasoning is already inside `outputTokens` and is not double-counted. For Google (`gemini-*`) models reasoning is reported separately and is summed into the output cost bucket.
87
87
-**Credits** — when present, `totalNanoAiu` is divided by 10⁹ to get the AI Credit count (`1 credit = $0.01`). Always surfaced in JSON. Drives the cost figure under `auto` / `display` when present.
88
-
-**Pricing** — for `calculate` / `api-equiv` mode, costs are computed from LiteLLM pricing data using a normalized form of the model name. The raw name (e.g. `claude-opus-4.7-1m-internal`) is preserved in JSON, the table's `Models` column, and `modelsUsed`.
88
+
-**Pricing** — for `calculate` / `api` mode, costs are computed from LiteLLM pricing data using a normalized form of the model name. The raw name (e.g. `claude-opus-4.7-1m-internal`) is preserved in JSON, the table's `Models` column, and `modelsUsed`.
Copy file name to clipboardExpand all lines: docs/guide/cost-modes.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ccusage supports three cost calculation modes to handle various scenarios and da
7
7
Claude Code stores usage data in JSONL files with both token counts and pre-calculated cost information. ccusage can handle this data in different ways depending on your needs:
8
8
9
9
-**`auto`** - Smart mode using the best available data
10
-
-**`calculate`** (also aliased as **`api-equiv`**) - Always calculate from token counts (LiteLLM pricing)
10
+
-**`calculate`** (also aliased as **`api`**) - Always calculate from token counts (LiteLLM pricing)
11
11
-**`display`** - Only show pre-calculated costs
12
12
13
13
## Mode Details
@@ -61,11 +61,11 @@ The `calculate` mode always computes costs from token counts using model pricing
61
61
ccusage daily --mode calculate
62
62
ccusage monthly --mode calculate --breakdown
63
63
64
-
# `api-equiv` is an alias for `calculate` (same behavior — bills from
64
+
# `api` is an alias for `calculate` (same behavior — bills from
65
65
# LiteLLM token pricing). The shorter, intent-revealing name is useful
66
66
# for Copilot reports where you want to contrast the "API-equivalent"
67
67
# cost against `auto`'s "what Copilot actually billed" figure.
|`auto`| True bill, era-aware: AIU when present (post-cutover) → premium-requests × $0.04 when present (pre-cutover) → token-priced via LiteLLM (no billing fields). The default. Free-tier pre-cutover rows (`requests.cost == 0`) bill as $0. |
|`calculate` / `api-equiv`| Always token-priced via LiteLLM (`normalize_copilot_model()` applied at both `calculate_cost_for_usage` and `missing_pricing_model_for_usage` call sites). |
96
+
|`calculate` / `api`| Always token-priced via LiteLLM (`normalize_copilot_model()` applied at both `calculate_cost_for_usage` and `missing_pricing_model_for_usage` call sites). |
97
97
98
98
The era-aware default reflects that GitHub Copilot switched billing models on
99
99
June 1, 2026: pre-cutover sessions were billed in "premium requests" with
0 commit comments