CLI Commands
SDKCommand-line interface reference for the Traccia SDK.
The Traccia CLI provides utilities for managing configuration, validating setups, and diagnosing connectivity issues. All commands are accessed through the traccia command.
Global Options
These options can be used with any command:
--config PATHPath to config file (default: ./traccia.toml or ~/.traccia/config.toml)
traccia config init
Initialize a new traccia.toml configuration file in the current directory with default values and helpful comments.
Usage
traccia config init [OPTIONS]Options
--forceOverwrite existing config file if present
Example
# Create traccia.toml in current directorytraccia config init
# Overwrite existing configtraccia config init --forceNext steps after init
- Edit the file to add your API key and endpoint
- Run
traccia doctorto validate - Run
traccia checkto test connectivity
traccia doctor
Validate your Traccia configuration and diagnose common issues. This command checks for config files, environment variables, validates configuration structure, and reports potential problems.
Usage
traccia doctor [OPTIONS]What it checks
Config file existence
Looks for traccia.toml in standard locations
Environment variables
Lists all set Traccia env vars
Configuration validity
Validates config structure and values
Exporter configuration
Ensures at least one exporter is enabled
Endpoint setup
Checks if OTLP endpoint is configured when needed
Rate limiting
Reports rate limiting settings if enabled
Example Output
🩺 Running Traccia configuration diagnostics...
✅ Found config file: ./traccia.toml
📋 Environment variables: ✅ TRACCIA_API_KEY is set
🔍 Validating configuration...✅ Configuration is valid
📊 Configuration summary: • API Key: ✅ Set • Endpoint: http://localhost:4318/v1/traces • Sample Rate: 1.0 • OTLP Exporter: ✅ Enabled • Console Exporter: ❌ Disabled • File Exporter: ❌ Disabled • Auto-patching: ✅ Enabled
============================================================✅ No issues found! Your configuration looks good.
💡 Tip: Run `traccia check` to test connectivity to your endpointExample
# Validate default configtraccia doctor
# Validate specific config filetraccia doctor --config /path/to/traccia.tomltraccia check
Test connectivity to your configured exporter endpoint. This command attempts to reach the endpoint and reports whether it's accessible.
Usage
traccia check [OPTIONS]Options
--endpoint URLOverride endpoint URL for this check (useful for testing different backends)
--api-key KEYAPI key for authentication (overrides config)
Examples
# Check configured endpointtraccia check
# Check specific endpointtraccia check --endpoint http://localhost:4318/v1/traces
# Check with custom API keytraccia check --api-key your-api-key-here
# Check production endpointtraccia check --endpoint https://api.traccia.ai/v2/traces --api-key prod-keyExpected responses
Exit Codes
0Success - endpoint is reachable1Failure - endpoint unreachable or configuration errortraccia pricing
Manage the local LLM pricing snapshot that the SDK uses to estimate costs at span-end time. The snapshot is stored in ~/.cache/traccia/pricing.json and resolves with higher priority than the bundled snapshot shipped inside the SDK wheel.
traccia pricing status
Show the current pricing source, its age in days, and the number of models in the active snapshot.
traccia pricing statusPricing snapshot status Source : local_cache File : /Users/you/.cache/traccia/pricing.json Age : 1 day(s) Models : 2547 Warning : NoneThe SDK emits a logger.info reminder when the snapshot is older than 7 days, and a logger.warning when older than 30 days.
traccia pricing refresh
Download the latest pricing and write it to the local cache. By default, the command tries the Traccia platform first (which maintains an up-to-date snapshot in sync with your org overrides), then falls back to the upstream open-source pricing database if the platform is unreachable.
Usage
traccia pricing refresh [--source platform|upstream]Options
--source platformFetch from the Traccia platform only. Returns HTTP 304 (Not Modified) and exits immediately if the cached ETag matches — no unnecessary download.
--source upstreamSkip the platform and fetch directly from the upstream LiteLLM pricing database. Useful when you do not have a Traccia account or want to bypass any org-level overrides.
Examples
# Default: platform first, upstream fallbacktraccia pricing refresh
# Force upstream (skips platform, no account needed)traccia pricing refresh --source upstream
# Force platform onlytraccia pricing refresh --source platformExample output
# First run — new snapshot downloadedPricing updated from platform (2547 models)
# Subsequent run — cached, no downloadPricing is already up to date (304 Not Modified)
# Platform unreachable — fallback usedPlatform unreachable, falling back to upstream...Pricing updated from upstream (2547 models)ETag caching
If-None-Match on the next run. If pricing has not changed, the platform responds with HTTP 304 and no data is transferred.traccia pricing clear
Remove the local cache file. The SDK reverts to the bundled snapshot that ships inside the SDK wheel until you run traccia pricing refresh again.
traccia pricing clearLocal pricing cache cleared. SDK will use bundled snapshot.Pricing and the Traccia platform
traccia pricing refresh syncs the platform's current snapshot to your SDK so that llm.cost.usd (SDK-emitted) and platform_cost_usd (platform-recomputed) converge, but the platform will always recompute costs server-side regardless. See Platform Costs for the full picture.Environment Variables
Common environment variables recognized by the CLI and SDK:
TRACCIA_API_KEY or AGENT_DASHBOARD_API_KEYAPI key for authentication
TRACCIA_ENDPOINT or AGENT_DASHBOARD_ENDPOINTEndpoint URL for trace ingestion
TRACCIA_SAMPLE_RATESampling rate (0.0 to 1.0)
TRACCIA_ENABLE_METRICSEnable OpenTelemetry metrics emission (true/false)
TRACCIA_METRICS_ENDPOINTOTLP/HTTP endpoint for metrics (overrides config)
TRACCIA_DEBUGEnable debug logging (true/false)
For a complete list of environment variables, see the Configuration Reference.
Common Workflows
Setting up a new project
# 1. Install Tracciapip install traccia
# 2. Create config filetraccia config init
# 3. Edit traccia.toml to add your settings# (set endpoint, api_key, etc.)
# 4. Validate configurationtraccia doctor
# 5. Test connectivitytraccia checkDebugging connectivity issues
# Check your configurationtraccia doctor
# Test specific endpointstraccia check --endpoint http://localhost:4318/v1/tracestraccia check --endpoint https://api.traccia.ai/v2/traces
# Enable debug logging in your appexport TRACCIA_DEBUG=truepython your_app.pySwitching environments
# Development (local OTLP)export TRACCIA_ENDPOINT=http://localhost:4318/v1/tracesexport TRACCIA_DEBUG=truetraccia check
# Production (Traccia platform)export TRACCIA_ENDPOINT=https://api.traccia.ai/v2/tracesexport TRACCIA_API_KEY=your-production-keytraccia checkNext Steps
© 2026 Traccia.