AI costs, down to the function.

Your OpenAI dashboard says you spent $2,000. CostKey tells you generateSummary() in src/features/search.ts:47 spent $1,200 of that — with one CLI command.

Open source SDKs on GitHub · npm + PyPI

Node Python
1npx costkey setup
1pipx run costkey setup
Works with 15 providers · Zero config

Already using Portkey, Helicone, or LiteLLM? CostKey runs on top. Same setup command. No proxy changes.

Dashboard

Tour every expensive AI decision.

Spend trends, request traces, prompt metadata, tool calls, agent runs, deploy diffs, and anomaly alerts. Everything auto-populated from your existing code.

app.costkey.dev
CostKey Dashboard
What you get

Every feature your AI bill is missing.

01 / PER-FUNCTION

Know which function spent it.

Not the model. The line of code.

02 / CUSTOM PROVIDERS

Track any provider. Even your own.

Private model? Internal gateway? Six lines.

03 / FEATURE-LEVEL GROUPING

Per-function is automatic. Per-feature takes one line.

Roll spend up by feature, product, or customer. For the bill your manager actually reads.

04 / FRAMEWORKS

One middleware. Full trace.

One request. All its AI calls. Grouped.

FastAPI
Django
Express
Next.js
Flask
Lambda
05 / PROMPTS + AGENTS

Capture the full AI run.

Prompts, system prompts, responses, tool calls, provider metadata, agent runs, retries, and errors all land on the same trace.

06 / PRIVACY

Prompts are captured safely.

No proxy. Credential scrubbing by default. Use hooks to redact or drop anything sensitive.

Comparison

Why CostKey?

Other tools need you to rewrite your codebase. CostKey is one setup command. And it sees deeper.

CostKeyPortkey / HeliconeLiteLLM
Integration1 CLI command. No proxy changesRewrite all AI calls to use their SDKReplace all imports
How it worksPatches fetch/httpx invisiblyProxy or SDK wrapperProxy gateway
Latency added0ms20-50ms per callVariable
Cost per functionAutomatic. File, function, lineManual tags onlyManual tags only
Catch runaway loopsPer-function anomaly detectionGlobal alerts
Streaming TTFT + TPS
Prompt + tool capture with scrubbing hooks proxy-side
Data privacyYou control what's sentAll data flows through proxyAll data flows through proxy
PriceFree$49+/moFree (self-host)
Pricing

Start free. Scale when you're ready.

Free
$0
For developers and small teams
Get Started →
  • Unlimited events
  • All 15 providers
  • Cost per function & deploy
  • Request traces
  • Spike alerts (webhook)
  • 90-day retention
Enterprise
Custom
For teams with production AI workloads
Talk to us →
  • Everything in Free
  • Unlimited retention
  • Unlimited team members
  • SSO / SAML
  • Self-hosted deployment
  • Slack & PagerDuty alerts
  • Dedicated support & SLA

Ship the setup command.

Authenticate in the browser, create a project, write your DSN, detect the framework, and get the exact init snippet or no-code sidecar preload.

Auto Node Auto Python Entry Node Entry Python
1npx costkey setup 2# Detects Next.js, Express, Fastify, Vite, Hono, and Node apps.
1pipx run costkey setup 2# Detects FastAPI, Django, Flask, and Python apps. 3# Browser auth creates your project and writes COSTKEY_DSN.
1import { CostKey } from 'costkey' 2CostKey.init({ dsn: process.env.COSTKEY_DSN }) 3// Add this to your server entrypoint before AI calls.
1import os, costkey 2costkey.init(dsn=os.environ["COSTKEY_DSN"]) 3# Add this to your app entrypoint before AI calls.