The cheapest Claude API (and how to switch in one line)
The cheapest way to use Claude is to stop paying one fixed list price and instead route each request to the cheapest healthy seller for that model. UberLLM does this automatically: you call Claude Opus, Sonnet or Haiku through a single key — with either the OpenAI SDK or the Anthropic SDK (/v1/messages) — and pay the lowest live price, with UberLLM’s 10% fee already included in the number you see.
Why "cheapest" depends on the seller, not the model
Claude has a published list price per model, but that is not the only price you can pay for it. On a marketplace, several sellers offer the same Claude model at the same quality and the live price is whatever the cheapest healthy one is charging right now. The job of a gateway is to send each request to that seller for you, every single time, with no change to your code.
That is exactly what UberLLM does. You keep one key and one base URL, and every call to a Claude model is matched to the cheapest healthy seller for it. The price shown already includes UberLLM’s 10% fee, so the number on the live pricing board is the number you pay. A 5% fee applies only when you add credit, never per request.
Switch in one line
Claude works through both SDKs. With the OpenAI SDK, change only the base URL and key:
from openai import OpenAI
client = OpenAI(
base_url="https://api.uberllm.dev/v1",
api_key="ull_your_key_here",
)
resp = client.chat.completions.create(
model="anthropic/claude-sonnet", # pick any Claude model id from /models
messages=[{"role": "user", "content": "Hello, Claude!"}],
)
Prefer the Anthropic SDK? Point it at the same host and use /v1/messages — see the Anthropic SDK doc. This is the same path Claude Code uses.
Make it cheaper still
- Match the model to the task. Haiku-class models cost a fraction of Opus-class ones. Browse the full model list and compare the live input/output prices before you default to the biggest model.
- Keep reasoning scoped. You pay per token, so a tight system prompt and a sensible
max_tokenscut the output bill directly. - Fall back one line. If a request does not need frontier quality, change the model id to a cheaper open-weight model (DeepSeek, GLM, Qwen) and keep every other line the same.
You never pay for failures
If a Claude call fails before any output starts, UberLLM retries it on the next healthy seller automatically, and a request that never returns a result costs $0. You are billed only for output you actually receive — see how pricing works.