Skip to content

Commands

Check if the server is reachable.

Terminal window
bun run cli health
Server: http://localhost:3501
Status: ok

Authenticate via browser. Opens a sign-in page, creates an API key, and saves it locally.

Terminal window
bun run cli login
Opening browser for authentication...
Authenticated as user@example.com
API key saved to /Users/you/.config/codecosts/config.json

For headless/CI environments, pass an API key directly:

Terminal window
bun run cli login --api-key sk_your_api_key
FlagRequiredDescription
--api-keyNoUse an existing API key (skips browser flow)

Clear the saved API key.

Terminal window
bun run cli logout
Logged out. API key cleared.

Show the current authentication state.

Terminal window
bun run cli status
Server: http://localhost:3501
API key: set
Config: /Users/you/.config/codecosts/config.json

Show the authenticated user’s profile. Requires authentication.

Terminal window
bun run cli me
ID: 550e8400-e29b-41d4-a716-446655440000
Email: user@example.com
Name: Jane Doe
Created: 2026-01-15T10:30:00.000Z
Updated: 2026-02-20T14:15:00.000Z

List recent usage logs in a table. Requires authentication.

Terminal window
bun run cli usage
Timestamp Model In Out Cost Duration Status
2026-03-17 01:19:55 claude-opus-4-6 3 15 $0.0222 3,159ms 200
2026-03-17 01:19:49 claude-haiku-4-5 8 1 $0.0000 1,219ms 200
FlagDescription
--model <name>Filter by model
--limit <n>Number of results (default 20)
--endpoint <id>Filter by proxy endpoint
--from <date>Only logs after this date
--to <date>Only logs before this date

Show full detail for a single trace, including request and response bodies.

Terminal window
bun run cli usage:detail <id>
Trace: ae3c796c-18fe-49df-8ae0-25013a6c040c
Model: claude-opus-4-6 Status: 200 Duration: 3,159ms
Cost: $0.0222 Input: 3 tokens Output: 15 tokens
── Request ──────────────────────────────────────
{request body JSON, pretty-printed}
── Response ─────────────────────────────────────
{response body, pretty-printed or SSE events}

Show aggregated usage statistics with per-model breakdown.

Terminal window
bun run cli usage:summary
Total Cost: $5.56
Total Requests: 7
Input Tokens: 40
Output Tokens: 100
By Model:
claude-opus-4-6 $5.50 (2 requests, 30 tokens)
claude-haiku-4-5 $0.06 (5 requests, 110 tokens)