Know your AI costs before you run

Pre-execution cost prediction and budget enforcement for LLM applications. Stop bill shock before it happens.

The Problem

AI costs are unpredictable and can spiral out of control. Current tools only tell you after the damage is done.

!

Bill Shock is Common

"$120 OpenAI bill after AutoGPT ran 8 hours unchecked" - Real developer stories from every AI community.

X

No Built-in Controls

LangChain, CrewAI, AutoGPT - none of them have built-in cost controls. They leave it entirely to developers.

^

Quadratic Cost Growth

Context accumulation in agents compounds every turn. What starts at $0.01 can reach $10 in minutes.

The Solution

Tokencap predicts costs before execution and enforces budgets automatically. Open source and MIT licensed.

$

Pre-Execution Prediction

Know exactly what a request will cost before you send it. Exact input costs, output estimates with confidence intervals.

!

Budget Enforcement

Set hard caps per request, session, or project. Automatic termination at limits with graceful degradation options.

>

Agent Chain Support

Track costs across multi-step workflows. Iteration-aware budgets with loop detection and circuit breakers.

#

Real-Time Dashboard

Monitor costs by project, user, or model. Historical trends, alerts, and team-wide visibility.

Simple Integration

Drop-in replacement for your existing OpenAI client. Start tracking costs in minutes.

example.ts
import { Tokencap } from '@tokencap/sdk';

// Initialize with your API key
const tokencap = new Tokencap({
  apiKey: process.env.TOKENCAP_API_KEY,
  budget: {
    maxCostPerRequest: 0.10,  // $0.10 max per request
    maxCostPerSession: 5.00,  // $5.00 max per session
  }
});

// Wrap your OpenAI client
const openai = tokencap.wrap(
  new OpenAI({ apiKey: process.env.OPENAI_API_KEY })
);

// Get cost estimate before execution
const estimate = await tokencap.estimate({
  model: 'gpt-4',
  messages: [{ role: 'user', content: prompt }]
});

console.log(estimate);
// { inputCost: 0.03, outputCost: { min: 0.02, max: 0.08 }, total: { min: 0.05, max: 0.11 } }

// Execute with automatic budget enforcement
const response = await openai.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: prompt }]
});
// Automatically tracks cost and enforces budget limits

Simple Pricing

Start free, scale as you grow. Open source core with optional hosted dashboard.

Free

$0 / month

Perfect for side projects and experimentation.

  • 50,000 requests / month
  • Pre-execution cost estimates
  • Budget enforcement
  • Basic dashboard
  • Community support
Get Started

Team

$99 / month

For teams that need more capacity and control.

  • 2,000,000 requests / month
  • 20 team seats
  • Custom approval workflows
  • SSO integration
  • Audit logs
  • Dedicated support
Contact Sales

Stop Bill Shock Today

Join developers who are taking control of their AI costs. Open source, MIT licensed, and ready to use.