Compress prompts before inference
Call UsageTap Compress directly or enable it in the OpenAI and Anthropic wrappers. Compress works without UsageTap metered events and returns the original input when compression is skipped.
Use Compress by itself to remove unnecessary input tokens before inference. Add UsageTap metering when you also need customer limits, usage forecasts, and billing outputs.
Call UsageTap Compress directly or enable it in the OpenAI and Anthropic wrappers. Compress works without UsageTap metered events and returns the original input when compression is skipped.
When you also use UsageTap metering, report vendor cache hits separately so cost reporting distinguishes uncached input from discounted cache reads.
Use entitlements and vendor hints to route routine work to standard models while reserving premium models and heavier reasoning for calls that need them.
Add UsageTap metering when you need customer quotas, burst limits, and blocking policies alongside prompt compression.
Cost controls
Start with prompt compression. Add model selection, cache-aware reporting, and customer usage controls where they improve the economics of your application.
const compressed = await fetch(
"https://compress.usagetap.com/compress",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.USAGETAP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: reportPrompt,
aggressiveness: 0.5,
}),
},
).then((response) => response.json());
const response = await openai.responses.create({
model: "gpt-5.6-luna",
input: compressed.compressed_text,
});Each Compress response reports the original and compressed token counts, reduction, elapsed time, warnings, and the path taken. Optional UsageTap metering adds customer, feature, model, cache, and cost context.
Prompts reach the model with fewer unnecessary tokens. You can preserve critical text, evaluate representative inputs, and fall back to the original prompt when compression does not produce a useful result.
Start with standalone compression, then add metering and customer controls if you need them.