CostTrim
Not analytics. Optimization.

Know what your AI costs.
Then watch us cut it.

CostTrim is a drop-in proxy for OpenAI, Claude, Groq, DeepSeek, and Llama API. It tracks cost, tokens and latency per user like any observability tool — but its Inline Auto-Optimization Proxy also actively trims prompts and reroutes simple requests to cheaper models in real time, before the bill happens, not after.

OpenAI
Claude
Groq
DeepSeek
Llama API
Next.js
Docker
PostgreSQL
Request ledgeroptimized
model requested
gpt-4o
model billed
gpt-4o-mini
would have cost
$0.0210
actually billed
$0.0032
85% saved — automatically, no code change
Try it — no signup

Send a real prompt, see the real cost math

What observability-only tools can't do

Helicone, Langfuse, LangSmith and Portkey will show you the bill. We also shrink it.

The Inline Auto-Optimization Proxy actively rewrites requests before they reach the provider — it's not a dashboard suggestion you have to go implement yourself. Both mechanisms are on by default and fully visible in your logs; either can be switched off per workspace in one click if it doesn't fit how your app behaves.

System Prompt Trimmer

Appends a conciseness instruction to an existing system prompt automatically, cutting unnecessary completion tokens on every call — no prompt-engineering effort on your end.

Smart Model Routing

Detects short, classification-style calls (e.g. "classify", "extract", low max_tokens) and silently reroutes them to a cheaper same-family model — gpt-4o → gpt-4o-mini — while leaving everything else untouched.

Two ways in

Same dashboard, same tracking — however you get there.

For developers

You already have code

Point your existing OpenAI/Claude client at us with a one-line baseURL change, use our SDK, or run npx ai-metric init to have it done automatically.

import { createAIMetricClient } from "ai-metric-sdk";

const ai = createAIMetricClient({
  apiKey: process.env.AI_METRIC_API_KEY!,
  openaiApiKey: process.env.OPENAI_API_KEY!,
  baseUrl: "https://aicosttrim.com",
});

await ai.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello!" }],
  userId: "usr_123",
});
See full docs (cURL, Python, Node) →
No code needed

You don't write code — that's fine

Paste your OpenAI or Claude API key into a form, pick a model, and get back an embeddable chat widget for your website. One <iframe> tag — no other setup — and every conversation is tracked automatically, with a daily budget cap so you never get a surprise bill.

Dashboard → Chat Widget → paste key → copy embed code → paste into Squarespace, WordPress, anywhere.
Create your widget →
Free calculator

What's your prompt actually costing you?

Paste a real prompt, no signup required — see the monthly cost, and what shortening it plus routing to a cheaper model would save.

How it works

Not a black box. Every optimization is logged and toggleable.

01

Point your app at CostTrim

Instead of calling OpenAI or Anthropic directly, your app calls our proxy — one URL, one extra header (X-API-KEY), same request body.

02

We optimize, then forward it

Before your request reaches the provider, the Inline Auto-Optimization Proxy can trim your system prompt and reroute simple classification-style calls to a cheaper model — on by default, one click to turn off per workspace. Then it's sent on: OpenAI, Claude, and DeepSeek are detected automatically from the model name; Groq and Llama API route through their own dedicated endpoint.

03

You get the response, we log the rest

Your app gets a normal response in the same shape it always expected, at the same speed. In the background — never blocking you — we save the cost, tokens, latency, which model actually ran, and who asked.

Your app → CostTrim (optimize) → OpenAI / Claude → back to your app. Same response shape every time — what can change is which model answered and how the prompt was phrased, both visible in your dashboard.
Built for real teams

Not enterprise procurement — just sign up and see your numbers.

Engineers

See cost per customer, not just the total bill

You already know which of your users is which — we just attach the cost to them. Export monthly user costs to CSV with one click for effortless accounting and client rebilling.

Engineers

Never slows your app down

We log in the background. If our database has a bad day, your users still get their answer on time, every time.

Engineers

Nothing sensitive stays with us

Your OpenAI/Claude key passes through on each request and is never written to disk. Revoke your CostTrim key any time and we're locked out.

Whoever pays

A plain-English cost forecast

"At this pace you'll spend $340 this month" — see it coming before the invoice does, no spreadsheet required.

Whoever pays

Hard Spend Limits & Auto-Blocking

A Slack ping doesn't help at 3am when a runaway loop is quietly maxing out a customer's key. Set a daily limit and Auto-Block rejects the next request with a 429 the instant it's hit — before your provider bill does.

Whoever pays

Upgrade with a card, not a contract

One button, Stripe's own checkout page. No sales call, no PDF invoice to chase — cancel just as easily.

New — Pro & Business

Track ChatGPT & Claude usage — per employee

Your company already pays for Claude Enterprise or ChatGPT Enterprise — but the bill arrives as one lump sum. Team AI Usage connects to each provider's own admin analytics and shows you tokens, requests, and cost broken down per employee. Usage and cost only, never prompt content.

See how it works →
Pricing

Fits on one line — free to try, cheap to keep.

Pay only for what you actually use — OpenAI, Claude, Groq, DeepSeek, and Llama API requests all share the same limit, no separate plan per provider.

Answer 3 quick questions and we'll tell you which plan actually fits — no jargon, no upsell.

Sign up first, then upgrade from Dashboard → Billing — payment is handled entirely by Stripe's hosted checkout, we never see your card.

FAQ

Frequently asked

I don't know how to code — is this still for me?

Yes. Dashboard → Chat Widget lets you paste your OpenAI or Claude key into a form and get back a ready-made chat box to embed on your site — no code beyond one copy-pasted tag. Everything it does still shows up in your dashboard automatically.

What am I actually looking at once I log in?

A dashboard with your AI spend broken down by day, by model, and by which of your customers is using it. If numbers alone don't help, Executive Overview translates it into plain sentences: what you're on track to spend, and where you could save money.

Do you store my OpenAI or Anthropic API key?

No. You send it on every request via the Authorization header and we forward it straight to the provider. It's never written to our database.

Does this slow down my app?

The extra hop adds proxy latency (typically single-digit milliseconds), including the Inline Auto-Optimization step — it's a synchronous but lightweight in-memory rewrite, not a second API call. Log writes themselves are fire-and-forget — your response is never held up waiting on our database.

Will the Inline Auto-Optimization Proxy change what my AI actually does?

It can, which is why it's a real toggle, not a hidden default you can't see. The System Prompt Trimmer only appends a conciseness instruction to a system prompt you already sent — it never invents one. Smart Routing only reroutes calls that look like short classification/formatting tasks, and only within the same provider family, precisely to avoid breaking function-calling or structured-output behavior. Every redirect is visible in your logs (you're billed for whichever model actually ran), and you can turn either off per workspace in Settings in one click.

Which providers do you support?

OpenAI (GPT-5.x, gpt-4o, gpt-4o-mini, o1, and others), Claude (Opus, Sonnet, Haiku), Groq, DeepSeek, and Meta's Llama API. All five show up in the same dashboard, whether you call them directly or through your existing provider SDK.

How do I attribute requests to a specific user?

Pass a userId in the request (metadata.userId, or the userId field if you use our SDK). That's what powers the User Cost Explorer, per-user alerts, and letting you search 'what did this user actually ask'.

What happens if CostTrim goes down?

We sit in the request path, so a request routed through us during an outage would fail — the same risk as any other API dependency in your stack. We run on managed cloud infrastructure with standard monitoring; we don't currently publish a formal uptime SLA.

CostTrim — LLM Cost Tracking & Auto-Optimization Proxy