如何降低 OpenAI、Claude 和 xAI API 成本
How to reduce your LLM API costs
FUSR.ai 的指南列出降低 OpenAI、Claude 和 xAI API 成本的六種做法,包括拆分帳單找出主要支出、選擇較便宜模型、維持提示詞快取、設定用量上限、批次處理及減少傳送內容。
Six things that lower an OpenAI, Claude, or xAI API bill: know where the money goes, send easy requests to a cheaper model, keep prompt caching working, cap every key, batch what can wait, and send less. Plus when routing does not help at all.
Last updated October 27, 2026
Find out where the money goes
Before you change anything, split last month's bill by model, by key, and by tool. Most bills have one or two lines that matter: an agent that loops, a script that sends a whole file every time, or a top model answering questions a small one would get right.
Two things surprise people. Output tokens cost far more than input tokens: GPT-5.5 lists $5 per million in and $30 per million out. And long chats send the whole conversation again with every message, so the tenth message in a chat costs much more than the first.
Send easy requests to a cheaper model
Not every request needs the top model. A quick question, a rename, or a short summary is often answered just as well by a cheaper one. List prices per million tokens, input then output, show how wide the gap is:
| Model | Input | Output | Good for |
|---|---|---|---|
| Claude Opus 5.5 | $4 | $20 | Hard coding and reasoning |
| Claude Sonnet 5.5 | $2 | $10 | Most coding and writing |
| GPT-5.5 | $5 | $30 | Writing, images, long documents |
| Grok 4.7 | $2 | $6 | Quick questions, long documents |
| GPT-4o mini | $0.15 | $0.60 | Small, simple jobs |
You can do this by hand: pick a cheap default and switch up when a task is hard. A router does it per request. FUSR.ai's fusr/auto sorts each request by task and sends quick questions to the cheapest connected model first. Turn on cheapest-good-enough and every task goes to the cheapest model rated good enough for it. How the AI router works.
When routing does not help
Routing is not magic, and sometimes it saves nothing:
- Your work is already on a cheap model.
- Almost every request is hard, so it all belongs on the top model anyway.
- Switching models in the middle of a chat throws away the prompt cache, which can cost more than the cheaper model saves.
A well chosen pair, one strong model and one cheap one, gets most people a long way. Caching, caps, and trimming what you send often matter as much as clever routing.
Keep prompt caching working
When the start of a request is the same as a recent one (a system prompt, a file, the earlier part of a chat), providers can read it from a cache for much less than full price. Anthropic charges a tenth of the input price for cache reads, and a twentieth on Sonnet 5.5 and Opus 5.5, but a quarter more to write the cache. OpenAI and xAI cache on their own: GPT-5.5 lists cached input at $0.50 against $5, and Grok 4.7 at $0.50 against $2.
Habits that break caching:
- Switching models mid chat. Each model has its own cache.
- Putting something that changes, like the time, at the top of a system prompt.
- Long pauses. Cache entries expire after a few minutes without use.
FUSR.ai marks Anthropic requests for caching, keeps a chat on the model whose cache is warm, and shows what caching saved in your report, from your real token counts.
Put a cap on every key
One runaway script or agent loop can spend a month's budget overnight. Provider consoles offer budgets and alerts for an organization or project. A cap per key is tighter: each tool or teammate gets its own limit, and hitting it stops only that key.
FUSR.ai Free has one monthly cap on your FUSR.ai key. Pro and Team set daily and monthly caps on every key, with an alert at the dollar amount you choose.
Use batch for work that can wait
OpenAI and Anthropic both offer a batch API for jobs that can wait up to a day, such as tagging a backlog or running evals, at half the normal price. FUSR.ai does not route batch jobs, so send those to the provider directly.
Send less
- Start a new chat when the topic changes, instead of dragging the old context along.
- Send the part of a file that matters, not the whole repository.
- Set a max output length for jobs that only need a short answer.
- Keep system prompts short and stable, so they cache well.
If most of your bill is OpenAI
GPT-5.5 is the priciest of the default models, at $30 per million output tokens. Keep it for the work it is best at, let quick questions go to a cheaper model, keep the start of your prompts stable so OpenAI's automatic caching kicks in, and set a max output length. The same key can reach Claude and xAI models through FUSR.ai if you connect them.
What FUSR.ai does and doesn't do
It does
- Sends each request on your FUSR.ai key to a model that fits, by rules you can read and change.
- Keeps prompt caching working and shows what it saved, from your real token counts and list prices.
- Stops a key at the cap you set.
It doesn't
- Add anything to token prices. Your providers bill your keys directly.
- Promise a saving. Your report shows what happened with your own requests.
- Route batch jobs, embeddings, or image endpoints.
Originally published at fusr.ai/reduce-llm-api-costs. I work on FUSR.ai.
來源:DEV Community · dev.to