Afraid to open your AI bill?

It started as one prompt that made Claude talk like a caveman. It hit #1 on Hacker News. Now it trims what your agent reads and picks the right model for each task.

74kstars on GitHub

Developers at these companies starred Caveman.

74,000 stars on GitHub

What we do

Caveman cuts the cost of every agent turn.Caveman Cloud shows what every run costs, finds the waste, and improves it on Autopilot.

Fig 0.1System
LIVE TRAFFICTESTED FIXESAGENTS YOU RUNClaude CodeCodexOpenCodeand moreAGENTS YOU BUILD{ }Your appTypeScript · PythonMODELSAnthropicOpenAIGeminiCavemanREADS LESS · SAYS LESS · PICKS THE MODELCaveman CloudFINDS WASTE LIVETESTS EACH FIXPROVES THE SAVING

Agents you run

  • Claude Code
  • Codex
  • OpenCode
  • and more

Agents you build

  • { }Your app
  • TypeScript · Python

Caveman

Reads less · Says less · Picks the model

Live traffic ↓
Tested fixes ↑

Models

  • Anthropic
  • OpenAI
  • Gemini

Caveman Cloud

  • Finds waste live
  • Tests each fix
  • Proves the saving
Hover a partillustrative

Free and open source

All of Caveman

Caveman

For the agents you run, and the ones you build.

For
Developers. No caveman experience required.
Runs
Entirely locally, or in your production apps.
Works with
30+ coding agents, and the TypeScript or Python app you build.Claude CodeCodexOpenCodeGemini CLITypeScriptPython
Price
$0Adaptive model selection needs a free Caveman account.

Caveman / Agents you run

Claude Code, Codex, OpenCode. Any model.Half the bill.

Keep the agent you use. Caveman trims what every turn reads and writes, and hands each task to the cheapest model that gets it right.

Fig 1.1SCANNER
originalcavemanPASS src/cart.spec.tsPASS src/auth.spec.tsFAIL src/checkout.spec.ts× pays with saved cardTimeout 5000ms exceededat checkout.spec.ts:42PASS src/search.spec.tsTests 1 failed, 41 passed{ "id": 4182,"status": "error","items": [ 212 more ],"meta": { "page": 1,"next": null },"error": "rate_limited","retry_after": 30,"trace": "a9f3c1e0" }diff --git a/src/pay.ts@@ -40,6 +40,7 @@const total = sum(cart)- await charge(total)+ await charge(total, {+ idempotencyKey })return receipt}1 failedcheckout.spec.ts:42timeout at #paystatus errorrate_limitedretry in 30ssrc/pay.ts +2 -1charge() takes anidempotencyKey
HOVER TO SCRUBtest.log · 18,240 → 201 tok
  1. Fig 1.1SCANNER
    originalcavemanPASS src/cart.spec.tsPASS src/auth.spec.tsFAIL src/checkout.spec.ts× pays with saved cardTimeout 5000ms exceededat checkout.spec.ts:42PASS src/search.spec.tsTests 1 failed, 41 passed{ "id": 4182,"status": "error","items": [ 212 more ],"meta": { "page": 1,"next": null },"error": "rate_limited","retry_after": 30,"trace": "a9f3c1e0" }diff --git a/src/pay.ts@@ -40,6 +40,7 @@const total = sum(cart)- await charge(total)+ await charge(total, {+ idempotencyKey })return receipt}1 failedcheckout.spec.ts:42timeout at #paystatus errorrate_limitedretry in 30ssrc/pay.ts +2 -1charge() takes anidempotencyKey
    HOVER TO SCRUBtest.log · 18,240 → 201 tok

    Reads less.

    Logs, test output, JSON and diffs shrink before the model reads them. The original stays on disk if it asks.

    33.2% fewer input tokenswhole sessions, 18 of 18 answers right

  2. Fig 1.2SHREDDER
    cavemanGreat question! The reasonyour React component isre-rendering is likelybecause you're creating anew object reference oneach render cycle. I'drecommend using useMemo tomemoize the object.Connection pooling is atechnique where yourapplication keeps a set ofopen database connectionsthat can be reused acrossrequests, so you don't payfor a new handshake everytime you query.It looks like TypeScript iscomplaining about apossible null value here,because user might beundefined at this point.You'll want to add a guardbefore accessing itsproperties.New object refeach render.Wrap in useMemo.Pool reuse openDB connections.Skip handshake.Null in union.Add if (!user)return;
    HOVER TO FEED FASTERwords 30 → 8

    Says less.

    Answers drop the filler. Code, commands and errors come back byte for byte.

    65% less readable output≈ −10% of total tokens on long-horizon coding tasks

  3. Fig 1.3GATE
    Haiku 4.5Sonnet 5Haiku 4.5Opus 5Haiku 4.5Sonnet 5caveman
    HOVER TO SLOW TIMErate 1.00×

    Picks the model.

    Adaptive model selection gives every turn the cheapest model and effort that gets it right. Hard work still gets the frontier one.

    0.46× the cost per taskSWE-Interact + SWE-Together, 85 paired tasks vs always-Opus, same solve rate

Caveman / Agents you build

You built your agent.Keep every part of it.

Caveman sits where tool results become model input. Your framework still runs the show. Your provider still gets the call.

  1. Smaller tool results. Eligible logs, JSON, diffs and documents shrink before the model call.
  2. The original stays in reach. In supported agent loops, the model can ask for the exact original.
  3. Nothing else changes. A local runtime runs beside your app. Same framework, provider, keys and saved history.

TypeScript · Python · 21 adapters

Add it to your agent
agent.ts
import { streamText } from "ai";import { createMiddlewareRuntime } from "@caveman-ai/sdk/middleware";import { withCaveman } from "@caveman-ai/middleware/ai-sdk"; const runtime = createMiddlewareRuntime({  endpoint: "http://127.0.0.1:8787",  mode: "compress",});await runtime.ready(); const scope = {  namespace: "my-app",  session_id: conversationId,  branch_id: "main",  cache_epoch: "0",}; const result = streamText(  withCaveman(existingOptions, { runtime, scope }),);

npm install @caveman-ai/middleware @caveman-ai/sdk

npm i -g @caveman-ai/cli && CAVEMAN_MODE=compress caveman start

Vercel AI SDK · OpenAI · Anthropic · Google GenAI · LangChain · Strands · Mastra · MCP

Caveman / What people said

It started as a joke that made agents talk like cavemen.Then it went to #1 on Hacker News and #1 on GitHub Trending.

GitHub stars, live
108,463
points on Hacker News
904
on GitHub Trending
#1
Free and open source
Apache-2.0

“It is fun, and it costs you nothing measurable in quality.”

JetBrains
Denis Shiryaev82 paired coding tasks. 8.5% fewer output tokens; no detectable quality difference. Total cost varied.Read the study
404 Media

“A senior OpenAI employee has contributed code to the project, simply called ‘caveman.’”

From the article’s introduction. Full reporting requires a subscription.Joseph Cox
Hackaday

“Turns out, you can understand the caveman output just fine.”

Al Williams
Elastic

“The Elastic-Caveman initiative has successfully optimized AI response size without compromising quality or functionality.”

Elastic’s own variant: 63.6% fewer output tokens across eight live MCP scenarios.Sri Kolagani
Cited in researchCAVEWOMANAdobe researchers cite Caveman in their study of language compression.Adeyemi, Rossi & Dernoncourt · arXiv
  • If you’re not cavemaxxing you’re falling behind.

    drewbeck
  • Me think this good idea. Regular language unnecessary complex. Distract meaning.

    jongjong
  • So it’s a prompt to turn Jarvis into Hulk!

    andai
  • I don’t know about token savings, but I find the “caveman style” much easier to read and understand than typical LLM-slop.

    vova_hn2
  • if goal make code, few word better. if goal make insight, more word better. depend on task.

    shomp
  • kevin would be proud

    thorfinnn
  • honestly it will make my day not to have to read through entire essays about some trivial solution.

    saidnooneever
  • seeing something framed by a caveman in a couple of occasions peeled back a layer i didnt see before.

    trueno
  • this gave me a good laugh + some solid ideas.

    bhwoo48

Verbatim excerpts, each linked to its source. Community reactions are not benchmarks.

Free to start

All of Caveman Cloud

Caveman Cloud

See what every agent run costs, cut the waste, and improve on Autopilot.

For
The company paying for the agents
Runs
Hosted, or in your VPC on Enterprise
Works with
Coding agents, your own SDK calls, LiteLLM
Price
$0For one person, no card needed. Team is $300 a month after a 7-day free trial.

Demo workspace · fictional data

  1. 01Analytics

    See what every agent costs.

    One bill, split by agent, model and day.

    Caveman Cloud Analytics: total spend, a daily spend chart with one colour per agent, and the money Caveman saved.
    1. What your agents cost over the last 30 days.
    2. Each colour is one agent. Taller bar, bigger bill.
    3. Money Caveman saved you. Green means verified.
    Open in the demo
  2. 02Traces

    Every request, on the record.

    Look up any call your agents made, and what it cost.

    Caveman Cloud Traces: one row per request with its status, cost, speed and tokens.
    1. Every single request your agents made.
    2. See which ones failed, and what each cost.
    Open in the demo
  3. 03Team

    See who uses what.

    Spend for each coding agent, across everyone on your team.

    Caveman Cloud Agent usage: requests over time for each coding agent, and what each one costs.
    1. How much your team uses each coding agent.
    2. What each coding agent costs you.
    Open in the demo
  4. 04Improvements

    Caveman finds the waste.

    Every fix it suggests says what it would save you.

    Caveman Cloud improvement: a fix with its saving per day, what was found, the change and how it gets checked.
    1. Caveman spotted waste and put a price on it.
    2. It tries the fix on your old requests first.
    3. Autopilot tries fixes on a little traffic, undoes bad ones. You approve.
    Open in the demo
  5. 05Evals

    Evals so easy, a caveman could do it.

    Your own requests become tests, and every change gets graded.

    Caveman Cloud experiment: the current version and a proposed change run on the same saved requests, each answer graded pass or fail.
    1. Your real requests become tests.
    2. Every change gets graded before it ships.
    Caveman Cloud quality gate: saved cases every change must pass, with a passed check.
    1. Pass the checks and Autopilot unlocks.
    Open in the demo
Caveman Cloud Analytics: total spend, a daily spend chart with one colour per agent, and the money Caveman saved.

Demo workspace · fictional data

Caveman Cloud / Govern

Set the limits.Keep the record.

Soft and hard caps per project, rate limits per key and workflow, and rules that mask or block what should never reach a model. Changes land in the audit log.

Open governance in the demo
Guardrail rules that mask email addresses, block exposed secrets and block forbidden instructions
Governance overview: API keys, model access, guardrails, data retention and the monthly budget

One place for the controls.

Keys, model access, guardrails and data retention, with the month’s budget beside them.

Demo workspace · fictional data
Hard capSoft warningToday1stMonth end

Budgets that warn the owner

Cross a soft cap or reach a hard cap, and owners and admins get an Inbox item and an email.

Audit log: who changed budgets, guardrails, keys and members, and when

An audit log for every change

Budgets, guardrails, keys and roles: who changed what, and when.

Getting started

Before you install.

What to try first, what stays in place, and how to check the result.

What does Caveman do?

Caveman helps AI agents do the same work with fewer tokens. It asks for shorter replies, compresses eligible context and keeps the original available for recovery. Start with the part that matches your workload, then compare completed tasks before and after.

Find the right cost reduction
Can I keep my coding agent?

Yes. Caveman wraps supported agents including Claude Code, Codex, and Gemini CLI. Shorter replies also work in agents such as Cursor. Support for shorter replies and for context compression differs by agent, so check the setup guide for yours before installing.

Check your agent's setup
Do I need a Caveman account?

The local CLI, shorter replies and context compression work without a Caveman account. You still need the credentials or subscription required by your model provider or coding agent. Adaptive model selection needs a free account. Caveman Cloud needs an account, which you can open at app.caveman.so/signup.

Set up the local tools
Will fewer tokens lower my bill?

It depends on how you pay. Fewer billable tokens can reduce metered API spend, but cached input, retries, and recovery calls affect the result. A flat monthly subscription may cost the same. Compare total cost per successful task and check provider billing before claiming savings.

Measure cost per successful task
Can I use Caveman with my existing AI gateway?

Often, yes. Gateways handle jobs such as credentials, routing, and traffic policies. Caveman's local tools can reduce eligible context before it reaches a gateway. Compatibility depends on the API path and recovery support. Each switching guide covers a bounded trial, validation, and rollback.

Compare your current stack

Caveman / Savings

Put a dollar on it.Your team. Your spend.

Fig 6.1Estimate
Layers3 of 4 on

Estimate · saved per month

$8,699 saved per month, $104,394 a year. Bill $12,500 becomes $3,801.−69.6%

$104,394 a year · bill $12,500 → $3,801

Hover a columnReads less −$3,320 · Says less −$918 · Picks the model −$4,461
How we count

Each layer has its own basis, below. Here the layers are multiplied, one after another. They were not measured together.

Reads less 33.2%
Fewer input tokens. Whole sessions, 6 tasks, 18 of 18 answers right.
Says less ≈10%
65% fewer readable output tokens on a 10-prompt benchmark. Readable output is a small part of a long coding task, so the calculator counts ≈10% of total tokens on long-horizon coding tasks, our own estimate.
Picks the model 0.46×
The cost per task, with adaptive model selection. Measured on SWE-Interact and SWE-Together: 85 paired agentic coding tasks, routed Claude Code vs always-Opus 5.5 at max effort, same solve rate. Interim run, list-price estimates.
Keeps the script up to 9.57%
Of task cost. Purdue's published ceiling for the share spent rewriting scripts. Blocks is pre-release.

Assumes 80% of agent spend is input tokens and 20% is output. If your team already runs models cheaper than Opus at max effort, routing saves less.

$12,500 × (0.8 × 0.668 + 0.2) × 0.9 × 0.46 = $3,801

The new Caveman

Get the full optimization stack.

Reads less. Says less. Picks the model. Keeps the script. One install, in the agent you already run.

30+YOUR AGENT01020304
  • 01Reads less−33%inputwhole sessions
  • 02Says less−65%readable output≈ −10% total on long coding tasks
  • 03Picks the model0.46×cost per taskSWE-Interact + SWE-Together
  • 04Keeps the scriptPre-release
Get Caveman
  1. 1Install
  2. 2Start your agent through Caveman
Runs on your machine, with your keys.108kDocs

Caveman Cloud for your team · Free to start

Start free