Skip to content

Free Rust engine. Paid profiles planned.

The same JSON. A representation for your model.

Tokendoo compresses your JSON locally, with a lossless round trip over its values. The engine and its reference tables are free. The planned service will offer model-specific profiles with compression settings, comprehension evaluations and version tracking.

0.3868

median token ratio, cl100k, derived alphabet, shipping fixtures

Wire ratio: compressed payload alone. The format legend adds 97 to 174 tokens and can erase the gain on small payloads.

published synthetic corpus · exact cl100k_base counts · 2026-08-07

JSON pays for structure, over and over.

A 1,000-row JSON array repeats its keys 1,000 times. Braces, quotes, field names, repeated strings: the API bills every one of them, on every request, at per-token prices.

Meaning lives in the values. Most of the bulk is repetition you can strip and put back exactly. That is the only part Tokendoo touches.

Four transforms, in order.

Each step is structural and reversible. We keep it only when the payload gets smaller. If nothing helps, we emit the input unchanged and say so in the header.

Canonicalisation

Drop whitespace, sort keys, normalise numbers. Gives every later step a deterministic input.

{ "sku": "a-114",  "qty": 2 }
{"qty":2,"sku":"a-114"}

Key dictionary, off by default

Repeated keys become base-36 ordinals plus a table. On the shipping corpus it missed the ≥10% token-gain bar, so it stays off until it earns a place.

{"quantity":2,"status":"active"}
{"0":2,"1":"active"}   k:["quantity","status"]

Tabular collapse

An array of same-shape objects becomes one schema row plus value rows. Keys are written once, not once per record.

[{"qty":2,"sku":"a-114"},
 {"qty":1,"sku":"a-115"}]
["__T",["qty","sku"],
 [[2,"a-114"],[1,"a-115"]]]

Value interning

Strings that repeat across the payload move into a table and get referenced by ordinal. The table ships with the output, and every figure on this page includes it.

"eu-west-1" × 40
"0" × 40   v:["eu-west-1"]

The result is a T3 wire string, T388:…, plus a JSON dictionary. Both count in every ratio. Quoting savings without the dictionary would overstate them.

The codec is free. Model-specific profiles will be paid.

The engine, corpus and benchmark harness are published under Apache 2.0. The included cl100k, o200k and Llama reference tables remain free. The planned service will provide evaluated profiles for covered models.

Symbol choice changes token cost. Current tables are derived from the target tokenizer vocabulary: their symbols each cost one token in isolation. The actual cost must also include their spelling inside JSON, the dictionary and the reading legend.

Same codec and reference fixtures. Median wire ratios include the dictionary and exclude the legend. Published synthetic corpus, exact cl100k_base counts, 2026-08-07.
alphabetmedian token ratio
control characters0.6575
printable prefix0.5241
bare base-360.4207
derived from vocabulary0.3868

The cl100k and Llama tables share 438 symbols out of the 1,377 in the Llama table. Their cost must be measured with the target tokenizer. The model’s ability to read the representation requires a separate evaluation.

A profile will combine an alphabet, compression settings and comprehension results for a defined model and set of tasks. The planned subscription will provide access to covered profiles, versioning and regression tracking.

The numbers we ship against.

Exact cl100k_base counts on a synthetic, published corpus, benched 2026-08-07 with the shipped defaults: derived_cl100k_v1 alphabet, tabular collapse and value interning on, key dictionary off. Every after-count includes the dictionary.

Token and byte ratios per fixture, exact cl100k_base counts, derived_cl100k_v1, 2026-08-07
fixturewhat it istokens intokens outtoken ratiobyte ratio
homogeneous_100100 records, one schema2 9031 2290.42340.327
homogeneous_10001,000 records, one schema29 0038 3870.28920.246
realistic_apimixed API response3 2002 4150.75470.689
size_10k≈10 KB mixed payload3 8601 4930.38680.304
size_100k≈100 KB mixed payload39 98311 6630.29170.246
size_250k≈250 KB mixed payload98 60329 1560.29570.247
prose_heavylong text values, thin structure2 9652 9801.00511.002

shipping fixtures, median token ratio 0.3868. Corpus and bench code are in the repository; re-running the bench reproduces every count.

The last row is where the tool does nothing. Structural compression has nothing to grip on prose, and prose_heavy comes out 0.5% larger. We keep the row: it is the case where this does not help, and you should see it.

Round-trip is enforced in the open repository: property-based tests require decompress(compress(x)) to equal x on JSON values.

Install the Rust crate.

One line in your manifest. Source on GitHub, versions on crates.io.

cargo add tokendoo

Compress locally. Call the model yourself.

The path that works

use tokendoo::compress;
use tokendoo::json::legend::legend_text_for_flags;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let input = r#"{"users":[{"id":1,"name":"a"},{"id":2,"name":"b"}]}"#;
    let result = compress(input)?;

    // Prompt pieces you send to your provider. Your key never leaves your process.
    let legend = legend_text_for_flags(result.flags);
    let dictionary = serde_json::to_string(&result.dictionary)?;
    send_to_provider(&legend, &result.compressed, &dictionary);

    Ok(())
}

fn send_to_provider(legend: &str, data: &str, dictionary: &str) {
    // POST to your provider with Authorization: Bearer <YOUR_KEY>.
    // Tokendoo is not on this path.
    let _ = (legend, data, dictionary);
}

What we never do

# We never sit in front of the model provider.
#   caller ──(your OpenAI/Anthropic key)──▶ tokendoo-proxy ──▶ model   ✗
#   caller ──▶ compress (local) ──▶ you ──(your key)──▶ model          ✓
# We never receive your provider key.
# We never see the model's response.
# We never receive your payload.

Language not covered yet? The codec is published under Apache 2.0: about four hundred lines of deterministic code. Reimplement it. There will be no compression API to wait for.

Nothing to leak, by design.

The codec processes JSON in your environment and does not send it to Tokendoo. You build the prompt and call your model provider with your own key.

The planned service will distribute downloadable profiles. Payloads will remain processed in your environment, independently of profile downloads.

This section describes payload processing. The waitlist has a separate purpose, stated in its form.

There is no paste box on this page, on purpose. A product built on not collecting payloads does not ask you to upload JSON to prove that it does not keep JSON.

What ships, what we are measuring, what is planned.

as of 2026-10-14

Shipped

  • tokendoo 0.1.0 on crates.io; API docs on docs.rs/tokendoo
  • Lossless round-trip over JSON values, checked by 1,000+ property-test cases
  • Local Rust library; compression never requires a network hop
  • JSON mode only; inputs up to 256 KiB

To validate

  • Per-model comprehension: the harness exists, but validated model coverage has not been established. The codec’s round trip does not prove answer quality.
  • Symbol choice inside actual JSON and transform selection. Measurements must include the dictionary and legend, then be confirmed on an independent corpus.

Planned

  • Local diagnosis: compare your JSON and available configurations, including the full cost of the representation.
  • First evaluated profile: explicitly identified tokenizer, model, settings, task types and comprehension results.
  • npm and PyPI publication from the same Rust core; bindings are present in the repository.
  • Downloadable, versioned profiles with verified table identities and decoding compatibility.
  • Subscription to profiles for covered models and a custom offer for your data shapes. Pricing follows validation.

Free engine. Paid model profiles.

Paid offer planned. Profiles and pricing will be offered after validation.

The library runs locally with its free reference tables. The planned subscription will provide access to profiles for covered models, their evaluations and maintenance.

Free

Apache 2.0 codec with included cl100k, o200k and Llama reference tables. Usable offline; they remain free in the releases that distribute them.

One family

Profiles for covered models within one family: alphabet, compression settings, evaluation scope and updates.

Multiple families

Access to profiles across all families actually covered. Each model will have an explicit validation scope.

Custom

Profiles optimized and evaluated on your data shapes and tasks, with execution in your environment.

The subscription will pay for profile access and maintenance. It will not depend on local usage counters or estimated savings.

A profile will be described as validated only for models and tasks actually evaluated. Codec fidelity and answer quality are verified separately.

The objections, before you raise them.

Seven questions a sceptical reader asks in the first two minutes. The answers are the ones we would give in a code review.

Why not just gzip the payload?
The model receives tokenized text. A gzip blob does not directly provide data in a form it can use. Tokendoo produces a reversible representation intended to be read in the prompt; model comprehension must be evaluated separately.
Doesn't prompt caching already solve this?
Provider caching lowers the price of a reused prefix. Tokendoo changes the representation of the data you send. The two can work together, but thresholds and pricing depend on the model: compressing a prefix can make it ineligible for caching. Measure the gain over the full call, including cache reads, writes and outputs.
Does the model actually understand the compressed form?
This has not yet been established across a set of covered models. The codec guarantees reconstruction of JSON values, which does not guarantee that the model answers as well. The comprehension harness exists. Future profiles must publish the tested model, tasks, representation cost and results before being described as validated.
Why paid profiles?
The engine and included reference tables remain free under Apache 2.0. The planned service will provide evaluated configurations for covered models, maintenance and custom profiles. A new model version does not necessarily change its tokenizer; representation cost and comprehension must be tracked separately.
Your fixtures are synthetic and you wrote them.
Yes. The corpus and benchmark harness are public and reproducible. Gains depend on structure, and prose-heavy JSON remains visible in the table despite showing no gain. Compare your own data, including the dictionary and legend.
Zero retention. How would I know?
Compression runs in your environment: the codec does not send your payloads to Tokendoo. Its code and tests are public. Your application remains responsible for sending prompts to the model provider and for its own logs. The waitlist separately collects an email address for the purpose stated in its form.
You are adding a network hop to save a few cents.
Compression runs locally. Reference tables are included in the library and usable offline. The planned service will let you download versioned profiles; your model calls will remain direct and will not pass through Tokendoo.

Leave an email. We send one when the library reaches npm and PyPI.

The Rust crate is published. One email when npm and PyPI ship, nothing before, nothing after.