Command-line interface for managing Routra API keys, routing policies, usage, batch jobs, and cost reporting.
cargo install routra# Login - securely stores your API key in ~/.routra/config.json
routra login
# Logout - removes stored credentials
routra logoutGet your API key from routra.dev/dashboard/keys.
You can also pass your API key directly:
# Via environment variable
export ROUTRA_API_KEY="rtr-..."
# Via flag (overrides env and config)
routra --api-key "rtr-..." keys list# List all keys
routra keys list
# Create a new key (optionally attach a routing policy)
routra keys create --name production
routra keys create --name staging --policy cheapest
# Rotate a key (old key stays active 24h)
routra keys rotate <key-id>
# Revoke a key (with confirmation prompt)
routra keys revoke <key-id># Push policies from a YAML file
routra policy push routra.yaml
# List all policies in your workspace
routra policy list
# Show full details of a policy
routra policy get <policy-name>
# Delete a policy (with confirmation prompt)
routra policy delete <policy-name>Example routra.yaml:
policies:
cheapest:
strategy: cheapest
production:
strategy: balanced
constraints:
allowed_providers: [coreweave, lambda]
gdpr-eu:
strategy: cheapest
constraints:
allowed_regions: [eu-west, eu-central]# View usage summary for the current billing period (all modalities: chat, images, TTS, STT)
routra usage# View cost breakdown by model and provider (includes all multimodal spend)
routra cost# Submit a JSONL file as a batch job
routra batch create requests.jsonl
routra batch create requests.jsonl --policy cheapest --window 1h
# Check job status
routra batch status <job-id>
# Get results URL for a completed batch
routra batch results <job-id>
# Cancel a queued or processing job
routra batch cancel <job-id>
# List all batch jobs
routra batch list| Flag | Env Variable | Description |
|---|---|---|
--api-key |
ROUTRA_API_KEY |
API key (overrides config file) |
--base-url |
ROUTRA_BASE_URL |
API base URL (default: https://api.routra.dev/v1) |
Credentials are stored in ~/.routra/config.json with owner-only file permissions (0600 on Unix).
{
"api_key": "rtr-...",
"base_url": "https://api.routra.dev/v1"
}- API key input is masked during
routra login(not visible on screen) - Config file permissions are restricted to owner-only on Unix
- Destructive operations (
keys revoke,policy delete) require confirmation - All communication uses HTTPS with rustls (pure Rust TLS)
MIT