Skip to content

Add parallel-cli usage get for billed usage - #193

Merged
sergei1152 merged 2 commits into
mainfrom
devin/1796260971-cli-usage
Dec 4, 2026
Merged

sergei1152 merged 2 commits into
mainfrom
devin/1796260971-cli-usage

Conversation

@sergei1152

@sergei1152 sergei1152 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds parallel-cli usage get, which shows billed usage from the Account API (GET /account/service/v1/usage, the same data as the Platform Usage page).

parallel-cli usage get [--last 7d|1w|1mo | --start YYYY-MM-DD --end YYYY-MM-DD] [--interval daily|weekly|monthly] [--json]
  • Dates are UTC. --end is exclusive. The default is the last 7 days, including today.
  • --last N<d|w|mo> sets the window relative to today (1d is today only; mo means calendar months). It cannot be used together with --start/--end.
  • The table groups rows by API (product). Each API has one row per period and processor, then a subtotal row, and a grand total comes last. App and API-key line items are summed for each row. --json prints the raw API response without subtotals.
  • Auth: usage:read is added to DEFAULT_SCOPE. Existing logins do not have this scope (a token refresh keeps the old scopes), so the command tells the user to run parallel-cli login again. HTTP 403 shows a message that org-admin access is required.
  • UsageResponse models in service_types.py were generated from the production Account API OpenAPI spec.

Verification

  • Ruff, ty, tach and pre-commit pass. Targeted pytest: 408 passed. Offline smoke passes for usage get.
  • Live parallel-cli usage get run (default 7 days) against a test org (excerpt). --last 1mo also passed live.
$ parallel-cli usage get
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┓
┃ Period (UTC) ┃ Product                   ┃ Processor                 ┃ Quantity ┃   Cost ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━┩
│ 2026-12-01   │ Search API                │ advanced                  │       84 │  $0.42 │
│ 2026-12-01   │ Search API                │ basic                     │       31 │ $0.155 │
│ 2026-12-02   │ Search API                │ advanced                  │      925 │ $4.625 │
│ 2026-12-02   │ Search API                │ basic                     │       56 │  $0.28 │
│ 2026-12-02   │ Search API                │ fast                      │      849 │ $0.849 │
│              │ Search API subtotal       │                           │          │  $8.46 │
├──────────────┼───────────────────────────┼───────────────────────────┼──────────┼────────┤
│ 2026-12-01   │ Extract Excerpts          │ default                   │       11 │ $0.011 │
│              │ Extract Excerpts subtotal │                           │          │ $0.011 │
├──────────────┼───────────────────────────┼───────────────────────────┼──────────┼────────┤
│ 2026-12-01   │ Responses API             │ low                       │        4 │  $0.04 │
│              │ Responses API subtotal    │                           │          │  $0.04 │
├──────────────┼───────────────────────────┼───────────────────────────┼──────────┼────────┤

@sergei1152
sergei1152 requested a review from a team December 3, 2026 01:26
@devin-ai-integration devin-ai-integration Bot added the devx-engineer Opened by DevX Engineer label Dec 3, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@sergei1152
sergei1152 merged commit 83b1ab4 into main Dec 4, 2026
7 checks passed
@sergei1152
sergei1152 deleted the devin/1796260971-cli-usage branch December 4, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devx-engineer Opened by DevX Engineer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant