Cased CLI
Query telemetry, monitor LLM usage, and analyze performance from your terminal
The Cased CLI provides command-line access to your observability data. Query errors, traces, metrics, and LLM usage directly from your terminal.
Installation
Section titled “Installation”uv pip install cased-cliConfiguration
Section titled “Configuration”Web Authentication (Recommended)
Section titled “Web Authentication (Recommended)”The easiest way to authenticate is via your browser:
cased configureThis will:
- Open your browser to the Cased login page
- You click “Authorize” after logging in
- CLI saves your token to
~/.config/cased/config.json
Works in SSH sessions too—just copy the URL from the terminal.
Environment Variables
Section titled “Environment Variables”Alternatively, set your API key as an environment variable:
export CASED_API_KEY=your_api_key_hereGet your API key from Settings.
Optionally set a custom API URL (defaults to https://app.cased.com):
export CASED_API_URL=https://app.cased.comManaging Authentication
Section titled “Managing Authentication”# Check current auth statuscased configure
# Re-authenticate (get a new token)cased configure --force
# Log out and remove saved credentialscased logoutQuick Start
Section titled “Quick Start”# Follow logs in real-timecased logs -f
# View recent errorscased errors --since 1h
# Check trace performancecased traces --service api --status error
# Monitor LLM costscased llm cost --since 24h
# Find slow spanscased perf slow --threshold 500
# Get overall statscased statsCommand Groups
Section titled “Command Groups”| Command | Description |
|---|---|
cased logs | Query application logs |
cased errors | Query error events |
cased traces | Query distributed traces |
cased metrics | Query container metrics |
cased stats | Overall telemetry statistics |
cased clusters | List clusters with telemetry |
cased sessions | List AI agent sessions |
cased session | Get session details |
cased sourcemaps | Manage source maps |
cased perf | Performance analysis |
cased llm | LLM monitoring |
Global Options
Section titled “Global Options”All commands support:
| Option | Description |
|---|---|
--json | Output as JSON instead of formatted tables |
--help | Show help for a command |
Application Logs
Section titled “Application Logs”cased logs
Section titled “cased logs”Query and tail application logs in real-time.
# Last 100 logs (default)cased logs
# Last 50 logscased logs --tail 50
# Follow logs in real-time (like docker logs -f)cased logs -f
# Follow with initial contextcased logs -f --tail 20
# Filter by levelcased logs -l errorcased logs -l warn
# Filter by servicecased logs -s api-server
# Search in messagescased logs -q "timeout"cased logs -q "connection refused" --since 1h
# Show full timestampscased logs -t
# Combine filterscased logs -f -l error -s api-serverOptions:
| Option | Default | Description |
|---|---|---|
--tail, -n | 100 | Number of lines to show |
--follow, -f | - | Follow logs in real-time |
--timestamps, -t | - | Show full timestamps |
--since | 1h | Time range (1h, 24h, 7d) |
--level, -l | - | Filter by level (trace, debug, info, warn, error, fatal) |
--service, -s | - | Filter by service name |
--search, -q | - | Search in log messages |
Error Tracking
Section titled “Error Tracking”cased errors
Section titled “cased errors”Query error events from your applications.
# Recent errors (last 24h)cased errors
# Errors in the last hourcased errors --since 1h
# Filter by severitycased errors --level errorcased errors --level fatal
# Search in exception type/valuecased errors --search "KeyError"cased errors --search "connection refused"
# Filter by projectcased errors --project my-project-id
# Output as JSONcased errors --since 1h --jsonOptions:
| Option | Default | Description |
|---|---|---|
--since | 24h | Time range (1h, 24h, 7d) |
--level | - | Filter by level (error, warning, fatal) |
--search | - | Search in exception type/value |
--project | - | Filter by project ID |
--limit | 50 | Max results |
Distributed Tracing
Section titled “Distributed Tracing”cased traces
Section titled “cased traces”Query distributed traces and spans.
# Recent tracescased traces --since 1h
# Filter by servicecased traces --service apicased traces --service worker
# Filter by statuscased traces --status errorcased traces --status ok
# Get all spans for a specific tracecased traces --trace-id abc123def456
# Filter by clustercased traces --cluster prod-us-eastOptions:
| Option | Default | Description |
|---|---|---|
--since | 1h | Time range |
--service | - | Filter by service name |
--status | - | Filter by status (ok, error) |
--trace-id | - | Get all spans for a trace |
--cluster | - | Filter by cluster ID |
--limit | 50 | Max results |
Metrics
Section titled “Metrics”cased metrics
Section titled “cased metrics”Query container metrics from your clusters.
# Recent metricscased metrics --since 1h
# Filter by podcased metrics --pod my-pod-abc123
# Filter by metric typecased metrics --metric cpu_percentcased metrics --metric memory_bytes
# Filter by namespacecased metrics --namespace productionOptions:
| Option | Default | Description |
|---|---|---|
--since | 1h | Time range |
--cluster | - | Filter by cluster ID |
--namespace | - | Filter by namespace |
--pod | - | Filter by pod name |
--metric | - | Filter by metric name |
--limit | 50 | Max results |
cased stats
Section titled “cased stats”Get overall telemetry statistics.
cased statscased stats --jsoncased clusters
Section titled “cased clusters”List clusters sending telemetry data.
cased clusterscased clusters --jsonAgent Sessions
Section titled “Agent Sessions”cased sessions
Section titled “cased sessions”List AI agent sessions.
# Recent sessionscased sessions --since 24h
# Filter by statuscased sessions --status completedcased sessions --status failedcased sessions --status agent_running
# Filter by typecased sessions --type root_cause_analysiscased sessions --type deploy_monitorOptions:
| Option | Default | Description |
|---|---|---|
--since | 24h | Time range |
--status | - | Filter by status |
--type | - | Filter by session type |
--limit | 20 | Max results |
cased session <session_id>
Section titled “cased session <session_id>”Get details for a specific session.
# Basic detailscased session abc123
# Include execution logscased session abc123 --logs
# Include conversation historycased session abc123 --conversation
# Full JSON outputcased session abc123 --jsonSource Maps
Section titled “Source Maps”Manage source maps for JavaScript error de-minification.
cased sourcemaps upload
Section titled “cased sourcemaps upload”Upload source maps for a release.
# Upload source mapscased sourcemaps upload -p my-app -r v1.2.3 dist/*.map
# With URL prefixcased sourcemaps upload -p my-app -r v1.2.3 --url-prefix "~/" build/*.map
# Using git SHA as releasecased sourcemaps upload -p my-app -r $GIT_SHA dist/*.mapcased sourcemaps list
Section titled “cased sourcemaps list”List uploaded source maps.
# All source maps for a projectcased sourcemaps list -p my-app
# Filter by releasecased sourcemaps list -p my-app -r v1.2.3cased sourcemaps delete
Section titled “cased sourcemaps delete”Delete source maps for a release.
# Interactive confirmationcased sourcemaps delete -p my-app -r v1.2.3
# Skip confirmationcased sourcemaps delete -p my-app -r v1.2.3 -yPerformance Analysis
Section titled “Performance Analysis”Analyze trace performance, detect bottlenecks, and find regressions.
cased perf slow
Section titled “cased perf slow”Find spans exceeding a duration threshold.
# Find slow spans (>500ms default)cased perf slow --since 1h
# Custom threshold (1 second)cased perf slow --threshold 1000
# Filter by servicecased perf slow --service api --since 24hOptions:
| Option | Default | Description |
|---|---|---|
--since | 1h | Time range |
--threshold | 500 | Minimum duration in ms |
--service | - | Filter by service |
--limit | 50 | Max results |
cased perf latency
Section titled “cased perf latency”View latency percentiles (p50, p95, p99).
# By servicecased perf latency --since 1h
# By endpointcased perf latency --service api --group-by endpoint
# Both service and endpointcased perf latency --group-by bothOptions:
| Option | Default | Description |
|---|---|---|
--since | 1h | Time range |
--service | - | Filter by service |
--group-by | service | Group by: service, endpoint, both |
cased perf n1
Section titled “cased perf n1”Detect N+1 query patterns.
# Find N+1 patternscased perf n1 --since 1h
# Require more repetitionscased perf n1 --min-count 10Options:
| Option | Default | Description |
|---|---|---|
--since | 1h | Time range |
--min-count | 5 | Minimum repetitions to flag |
--limit | 50 | Max results |
cased perf breakdown
Section titled “cased perf breakdown”Get service time breakdown for a trace.
cased perf breakdown <trace_id>Shows where time was spent across different services in a trace.
cased perf regression
Section titled “cased perf regression”Detect performance regressions by comparing time periods.
# Compare last day to last weekcased perf regression --service api
# Custom periodscased perf regression --service api --baseline 7d --compare 1d
# Filter by endpointcased perf regression --service api --endpoint /api/usersOptions:
| Option | Default | Description |
|---|---|---|
--service | (required) | Service to analyze |
--endpoint | - | Filter by endpoint |
--baseline | 7d | Baseline period |
--compare | 1d | Comparison period |
cased perf summary
Section titled “cased perf summary”Get overall performance summary.
cased perf summary --since 1hcased perf summary --since 24hLLM Monitoring
Section titled “LLM Monitoring”Track LLM usage, costs, latency, and errors.
cased llm usage
Section titled “cased llm usage”View token usage statistics.
# Usage by modelcased llm usage --since 24h
# Group by providercased llm usage --group-by provider
# Filter by modelcased llm usage --model gpt-4oOptions:
| Option | Default | Description |
|---|---|---|
--since | 24h | Time range |
--model | - | Filter by model |
--provider | - | Filter by provider |
--group-by | model | Group by: model, provider, both |
--limit | 50 | Max results |
cased llm cost
Section titled “cased llm cost”View estimated LLM costs.
# Cost by modelcased llm cost --since 24h
# Filter by modelcased llm cost --model claude-sonnet-4
# Group by providercased llm cost --group-by providercased llm latency
Section titled “cased llm latency”View LLM latency percentiles.
cased llm latency --since 24hcased llm latency --model gpt-4ocased llm errors
Section titled “cased llm errors”View LLM error statistics.
# Error ratescased llm errors --since 24h
# Filter by modelcased llm errors --model gpt-4ocased llm summary
Section titled “cased llm summary”Get overall LLM usage summary.
cased llm summary --since 24hcased llm summary --since 7dShows total calls, tokens, estimated costs, latency, and error rates.
cased llm sessions
Section titled “cased llm sessions”View per-session LLM usage for multi-turn conversations.
# Sessions by cost (most expensive first)cased llm sessions --sort-by cost
# Sessions by token usagecased llm sessions --sort-by tokens
# Recent sessionscased llm sessions --sort-by created --limit 10Options:
| Option | Default | Description |
|---|---|---|
--since | 24h | Time range |
--sort-by | created | Sort by: cost, calls, tokens, created |
--limit | 20 | Max sessions |
JSON Output
Section titled “JSON Output”All commands support --json for machine-readable output:
# Pipe to jq for filteringcased errors --since 1h --json | jq '.events[] | select(.level == "fatal")'
# Save to filecased llm cost --since 7d --json > weekly-costs.json
# Use in scriptsCOST=$(cased llm summary --json | jq -r '.estimated_cost_usd')echo "Weekly LLM cost: \$${COST}"Time Ranges
Section titled “Time Ranges”All --since options accept:
| Format | Example | Description |
|---|---|---|
| Hours | 1h, 6h, 24h | Last N hours |
| Days | 1d, 7d, 30d | Last N days |
Exit Codes
Section titled “Exit Codes”| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error (API error, connection error, invalid input) |