Reduce OpenAI API Costs by Optimizing Your Inputs
Practical ways to cut OpenAI API bills by sending fewer, better tokens: cleaning, compressing, and structuring prompts before every call.
Where the money goes
In RAG and document workflows, the prompt carries pages of context on every request. A 10 percent cut in context size is a 10 percent cut in most of your bill, multiplied by every call.
Five easy wins
Each of these takes minutes to apply:
- Convert HTML to Markdown with the Markdown Converter; tags can double token counts.
- Remove repeated system boilerplate and old chat turns.
- Deduplicate retrieved chunks before stuffing them in the prompt.
- Compress long background with the Context Compressor.
- Track before and after with the Token Counter.
Measure, don't guess
Pick five typical prompts, count their tokens, apply the cleanup, and count again. That small benchmark tells you the real savings for your workload and helps you decide which optimizations are worth automating.
Try it free in your browser
- Context Compressor — Reduce token usage with compression strategies tuned for LLMs.
- Markdown Converter — Paste HTML, DOCX, or webpage text and get tidy Markdown.
- Token Counter — Live token, character, and context-window meter for any prompt. Uses official tiktoken encoders.
Tools mentioned
Frequently asked
Are input or output tokens more expensive?
Output tokens cost more per token, but most applications send far more input than they receive, so input usually dominates the total bill.
Does compressing text hurt answer quality?
Removing noise usually improves quality. Aggressive summarization can drop details, so preserve key terms when compressing.
Keep reading
How to Prepare PDFs for ChatGPT, Claude, and Gemini
A practical guide to extracting clean, AI-ready text from PDFs — born-digital and scanned — so ChatGPT, Claude, and Gemini answer accurately and don't waste tokens on headers, footers, and page numbers.
The Best Way to Feed Long Documents to Claude (and Other Long-Context Models)
Claude's 200K-token context is generous, but you'll still want to clean, compress, and structure long documents before sending them. Here's a step-by-step playbook.
Cleaning Whisper Transcripts for AI Summaries
OpenAI Whisper, Otter, and YouTube transcripts are full of timestamps, filler words, and speaker noise. Here's how to strip them before sending to ChatGPT or Claude — and why it matters.