---
title: "trim-1"
description: "Compression · On GitHub trim-1 keeps the lines that answer your agent's question. Use it on a log, a file or search results. The lines stay exact."
canonical: https://caveman.so/models/trim-1
last-updated: 2026-11-30
---

# trim-1

Compression · On GitHub

trim-1 keeps the lines that answer your agent's question. Use it on a log, a file or search results. The lines stay exact.

[Get trim-1 on GitHub](https://github.com/caveman-ai/trim-1) · Join the API waitlist on this page

5M tokens free each month per organization.

Sample: asked "Why did the checkout payment fail? Find the ledger error.", trim-1 cut a 404-line checkout.log of
10,061 tokens down to the 9 lines around the ledger-db timeout, 228 tokens (o200k).

## What it does

Get the original lines back in the order they appeared.

### Keeps the original lines

Read the exact lines in order and see where text was cut.

### Hands back what it can't cut

On a blank question, a short payload or a cut under 10%, the payload comes back untouched.

### Runs in Cloud or on your machine

The standalone download is 1.2 MB and runs on one CPU core without a GPU.

## How it is measured

One run on 11 Oct 2026 on frozen holdout splits of public suites, at the balanced level, with token counts estimated
locally.

- **Tokens cut: 88.9%** fewer tokens on long documents, 8k to 32k tokens (n=90). 21.8% on retrieved code (n=150), 1.9%
  on coding-agent tool output (n=200). The long-document suite is the validation split of a dataset whose training
  split trim-1 learned from.
- **Answers right: 85.6%** against 88.9% from the full context, long documents (n=90); Claude Haiku reads, Claude
  Sonnet judges.
- **Speed: 7.2 ms** p50 for 5,000 tokens on one CPU core, no GPU (SuperCompress v1: 984 ms); 63 ms for 60,000.

### Tokens cut, by suite

Tokens cut and evidence kept on each suite, at the balanced level.

| Suite | Tokens cut | Evidence kept |
|---|---:|---:|
| Long documents, 8k to 32k tokens (n=90) | 88.9% | 94.4% |
| Retrieved code, lines the fix edits (n=150) | 21.8% | 90.7% |
| Coding-agent tool output, what the agent used next (n=200) | 1.9% | 100% |

### Answers right, by suite

Answers from the trimmed output: Claude Haiku reads, Claude Sonnet judges.

| Suite | Full context | trim-1 | SuperCompress v2 |
|---|---:|---:|---:|
| Long documents (n=90) | 88.9% | 85.6% | 63.3% |
| Public agent traces (n=100) | 100% | 99% | 84% |
| Logs, JSON, code and prose (n=60) | 91.7% | 70.0% | 43.3% |

## API reference

Use your Caveman Cloud key to call the model.

- **Endpoint:** `POST /v1/trim`
- **You send:** `input`, `query`, optional `level` (`conservative`, `balanced`, `aggressive`)
- **You get back:** `output`, `tokens_before`, `tokens_after`, `recovery_handle`, `model`
- **Size limit:** up to 2 MB a call
- **Storage:** `x-cave-retention: zdr` trims in memory and stores nothing
- **Runs:** Caveman Cloud, or your own binary (Apache-2.0)
- **Install:** `go install github.com/caveman-ai/trim-1/cmd/trim@latest`
- **Free each month:** 5M tokens

```sh
curl https://gateway.caveman.so/v1/trim \
  -H "Authorization: Bearer $CAVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "<tool output>", "query": "why did the job fail?"}'
```

## Caveman models

Each model cuts a different cost: input, conversation history or model calls.

- trim-1, input tokens: keeps the exact lines that answer your agent's question. On GitHub. This page.
- [compact-1](https://caveman.so/models/compact-1), conversation history: fits your agent's history into its token budget in 3.8 ms. Waitlist.
- [router-1](https://caveman.so/models/router-1), model choice: matches the model and effort to each call.
  Waitlist.

[Explore Caveman Cloud](https://caveman.so/cloud)

## Questions

Short answers on getting the rest back, where to get it and how it was counted.

### Can the agent get the rest back?

On Caveman Cloud, yes: the lines trim-1 cut stay retrievable by the response's `recovery_handle`. Send
`x-cave-retention: zdr` and trim-1 trims in memory and stores nothing.

### Where do I get trim-1?

Find trim-1 on GitHub or Hugging Face. Install the command line with `go install github.com/caveman-ai/trim-1/cmd/trim@latest`. It is free to run on your machine.

### How were the tokens counted?

Locally, with the cl100k_base tokenizer, so the counts are labelled inferred, not provider billing. On trim-1's
golden-test log, 10,061 tokens went in and 228 came out (o200k).

### How is it different from compact-1?

trim-1 cuts one payload against a question. compact-1 fits a whole agent history inside the token budget you set.

## Start with trim-1

[Get trim-1 on GitHub](https://github.com/caveman-ai/trim-1) · Join the API waitlist on this page

5M tokens free each month per organization.
