Smart Routing
Sends each request to the most cost-effective AI model that can do the job well, deciding instantly for every prompt.
Run your AI workloads through varsten to reduce your API bill, and stop worrying about wether you're getting the most bang for your buck.
Traffic is sent through routing, cache, trim, downshift, and prompt compression mechanisms. Batching is a separate async workflow for non-urgent jobs. Each lever is auditable and togglable.
Sends each request to the most cost-effective AI model that can do the job well, deciding instantly for every prompt.
Saves past AI answers and reuses them whenever a new request means the same thing, even if it's worded differently.
Cleans up prompts in real time by stripping out repeated text, extra whitespace, and unnecessary history before sending.
Rewrites long system instructions into permanently shorter versions to cut token costs, requiring human review before going live.
Uses test history to safely move routine tasks to cheaper models, testing changes on a small scale first with instant rollback.
Groups non-urgent requests together in the background to process them at heavily discounted batch rates.
Three ways to connect. Each provides a different level of security and control. The SDK wrapper is recommended for production traffic, the base URL is fastest for evaluation, and Direct Monitoring keeps sensitive workloads out of the request path.
The OpenAI wrapper sends healthy traffic through Varsten and falls back direct-to-provider on Varsten-origin failures before provider output starts. Your provider key stays local for fallback.
import { VarstenOpenAI, VarstenTrace } from "@varsten/openai";
const client = new VarstenOpenAI({
varstenApiKey: process.env.VARSTEN_API_KEY,
openaiApiKey: process.env.OPENAI_API_KEY,
onFallback: (event) => {
console.warn("varsten fallback", event.reasonCode);
},
});
const trace = new VarstenTrace();
await client.chat.completions.create(
{
model: "gpt-4o-mini",
messages,
},
{
varsten: trace.metadata({
feature: "support_agent",
taskType: "classification.intent",
customerId: "cust_123",
}),
},
);We charge a fee on verified savings, so you only pay when we save you money. Plans are billed monthly. No commitment, cancel anytime. If you just want to audit your traffic, you can do that for free.
Connect via Quick Eval or Direct Monitoring to audit your live traffic and map out estimated savings, with no behavior-changing optimization applied.
Unlocks the optimization engine: inline routing, cache, trim, compression, and downshift, plus async batching for eligible jobs. Pricing is capped at 25% of verified savings.
For custom pricing that doesn't scale with your bill,
we negotiate a rate and fee cap.