Skip to main content

AI spending tracker with cost-quality correlation

Project description

cost-intel

AI spending tracker with cost-quality correlation.

A standalone Python CLI that tracks AI spending at the task level, optionally correlates it with quality scores, and produces cost-efficiency metrics.

Value prop: No unified cost-quality metric in a CLI-native package.

Install

pip install cost-intel

Quick Start

# Record a cost run
cost-intel record --model "openai/gpt-4o" --input-tokens 150 --output-tokens 80 --label "summarize-doc"

# Show cost report for the last 7 days
cost-intel report --last 7d

# Show cost per quality point (CPQP) with percentile ratings
cost-intel cpqp --last 30d

# Refresh model pricing from OpenRouter
cost-intel refresh-pricing

# Set a monthly budget
cost-intel budget set --monthly 500

# Check budget status
cost-intel budget status

Features

  • Cost tracking — Record AI runs with token counts, compute costs from live pricing
  • Quality correlation — Import quality scores, compute CPQP (cost-per-quality-point) with A/B/C/D/F percentile ratings
  • Waste detection — Identify expensive low-quality runs
  • Model comparison — Compare models by efficiency delta
  • Budget alerts — Slack + SMTP alerts when spending exceeds thresholds
  • CI/CD gates — Fail builds when CPQP exceeds a threshold
  • OTel traces — Ingest OpenTelemetry spans, get trace-level cost breakdowns
  • Prompt optimization — Analyze high-cost patterns and get trimming suggestions
  • Budget enforcement — Hard-stop guard that blocks when budget is exceeded

Commands

cost-intel record              Record a cost run
cost-intel report              Cost summary report
cost-intel trends              Daily spending or CPQP trends
cost-intel export              Export to CSV
cost-intel budget set          Set a budget
cost-intel budget status       Check budget status
cost-intel refresh-pricing     Fetch latest pricing from OpenRouter
cost-intel pricing set/show    Manual pricing override
cost-intel estimate            Estimate tokens/cost before a call
cost-intel ingest-api-responses  Ingest JSONL API responses
cost-intel cpqp                CPQP report with percentile ratings
cost-intel waste               Waste analysis + waste index
cost-intel compare-models      Compare models by efficiency
cost-intel optimize            Model routing + target CPQP suggestions
cost-intel import-scores       Import quality scores (CSV, Eval Harness, Braintrust)
cost-intel gate                CI/CD cost gate (exit 0/1)
cost-intel alert check         Run budget alerts
cost-intel alert test          Show configured alert channels
cost-intel trace-cost          OTel trace cost breakdown
cost-intel prompt-opt          Prompt optimization analysis
cost-intel guard               Budget enforcement guard

Configuration

Config lives at ~/.cost-intel/config.yaml (override with COST_INTEL_HOME):

budget:
  monthly: 500

alerts:
  slack_webhook_url: "https://hooks.slack.com/..."
  email:
    smtp_host: "smtp.gmail.com"
    smtp_port: 587
    from: "alerts@example.com"
    to: "you@example.com"

quality:
  weights:
    accuracy: 0.5
    relevance: 0.3
    coherence: 0.2

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cost_intel-0.1.0.tar.gz (196.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cost_intel-0.1.0-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file cost_intel-0.1.0.tar.gz.

File metadata

  • Download URL: cost_intel-0.1.0.tar.gz
  • Upload date:
  • Size: 196.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cost_intel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cab4224538c4c8b23dd8e314e87a2819d1489e60eee3938798f44430dee9d5ca
MD5 85f63250a7f958a8ff16b636e36dba39
BLAKE2b-256 a76f0c356855fa59e4c6a4055b7ede0e315c827a3554b939b68139605b42bdfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for cost_intel-0.1.0.tar.gz:

Publisher: publish.yml on onicarps/cost-intel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cost_intel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cost_intel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cost_intel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfc0b1778ccd3381ce3df0c4d4a797a174f06585e2767ef3a1f8cd7804edc3e7
MD5 50dbb675bcf451218bdc6628b80a3b01
BLAKE2b-256 9dcb86a013375b4dc17c8566ed285890f7b2e4cab0250da8410765091b044b32

See more details on using hashes here.

Provenance

The following attestation bundles were made for cost_intel-0.1.0-py3-none-any.whl:

Publisher: publish.yml on onicarps/cost-intel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page