5 Ways I Reduced My OpenAI Bill by 40%
<p>When you first start using LLMs in your product, the costs seem manageable. But as you scale, they can quickly become one of your biggest expenses. A few months ago, my OpenAI bill was getting out of hand. I<br> knew I had to do something about it.</p> <p>After a few weeks of focused effort, I managed to cut my monthly LLM spend by over 40%. Here are the five most impactful changes I made.</p> <ol> <li>Caching is Your Best Friend</li> </ol> <p>This one might seem obvious, but it's amazing how many people don't do it. I found that a significant number of my API calls were for the exact same prompts. I set up a simple Redis cache to store the results of<br> common prompts. If a prompt is already in the cache, I just return the cached response instead of hitting the OpenAI API.</p> <p>This
When you first start using LLMs in your product, the costs seem manageable. But as you scale, they can quickly become one of your biggest expenses. A few months ago, my OpenAI bill was getting out of hand. I knew I had to do something about it.
After a few weeks of focused effort, I managed to cut my monthly LLM spend by over 40%. Here are the five most impactful changes I made.
- Caching is Your Best Friend
This one might seem obvious, but it's amazing how many people don't do it. I found that a significant number of my API calls were for the exact same prompts. I set up a simple Redis cache to store the results of common prompts. If a prompt is already in the cache, I just return the cached response instead of hitting the OpenAI API.
This is especially effective for things like summarizing the same article for multiple users, or for common customer support questions. It's a quick win that can save you a surprising amount of money.
In my own application, I have a feature that generates a market analysis for specific keywords. I noticed that popular terms like "AI in Healthcare" were being requested hundreds of times a day by different
users. By implementing a simple Redis cache with a 24-hour TTL for the generated analysis, I achieved a cache hit rate of over 60% for the feature. This single change cut the feature's operational costs in half with zero impact on the user experience.
- Use Cheaper Models for Simpler Tasks
Not every task requires the power (and cost) of GPT-4o. I was using the most expensive model for everything by default. I did an audit of all my API calls and realized that many of them were for simple tasks
like sentiment analysis, keyword extraction, or basic summarization.
I switched to using cheaper, faster models like gpt-3.5-turbo for these tasks. I even use claude-3-haiku for some things. The cost difference is huge, and the quality is more than good enough for simpler use
cases. The key is to build a simple router that sends prompts to the right model based on the task's complexity.
- You Can't Optimize What You Can't Measure
This was the biggest one for me. I had no idea where my money was actually going. I just had a single number at the end of the month.
To get a handle on it, I built a cost monitoring dashboard called https://llmeter.org. It connects to my OpenAI, Anthropic, and other provider accounts and gives me a detailed breakdown of my spend by model, by feature, and even by user.
Within the first week of using it, I found a single user who was responsible for almost 20% of my total costs. I was able to optimize their usage. This one insight saved me over $200 in the first month.
If you don't have visibility into your costs, you're just guessing.
- Prompt Engineering is Cost Engineering
The shorter and more efficient your prompts are, the less you'll pay for both input and output tokens. I spent a few days going through my most common prompts and optimizing them for brevity and clarity.
For example, instead of a verbose prompt like: ▎ "Please analyze the following customer feedback and tell me if the sentiment is positive, negative, or neutral. Also, please extract the key topics of the feedback. The feedback is: [text]"
I changed it to a more concise, system-style prompt: ▎ "Analyze sentiment (positive/negative/neutral) and extract key topics. Input: [text]"
This simple change reduced my average prompt size by about 30%, which adds up to significant savings at scale.
- Set Budgets and Alerts
This is your safety net. Most LLM providers don't have great built-in budget alerting. You usually find out you've overspent when you get the bill at the end of the month.
I set up daily and monthly budget alerts in LLMeter. If my spend goes over a certain threshold, I get an email and a webhook notification. This lets me catch any unexpected spikes in usage before they become a
major problem. For instance, I set a daily budget of $50. Last week, I got an alert at noon that I had already hit $45. I quickly discovered a runaway script in a new deployment that was making thousands of
unexpected API calls. I disabled the feature, fixed the bug, and redeployed. Without that alert, the script would have run all day and cost me over $100 instead of just $45. Simple, but it gives me peace of
mind.
Controlling your LLM costs is all about being intentional. By caching, using the right models, measuring everything, optimizing your prompts, and setting up alerts, you can make your AI features much more
profitable and sustainable.
Sign in to highlight and annotate this article

Conversation starters
Daily AI Digest
Get the top 5 AI stories delivered to your inbox every morning.
More about
claudemodelproductPaper Finds That Leading AI Chatbots Like ChatGPT and Claude Remain Incredibly Sycophantic, Resulting in Twisted Effects on Users - Futurism
<a href="https://news.google.com/rss/articles/CBMikwFBVV95cUxQWnR0SXhyVm01QXZhUTNsWDNYSFNoNDZnRWpuN3M0Skw5LXJVNFVOSWg4TWRXSEFqY2Zab0M2LWhKV1hZa0xKcDJId19RSW1WRndVREU1TFVZSl8tZ3U1MGk3U2kzWWtDbm9ZWmNMM3R5VFpMdXJ3ZzlHaXZGR2FQbHBqeWFZekppZHdhVTYyU3BnWDA?oc=5" target="_blank">Paper Finds That Leading AI Chatbots Like ChatGPT and Claude Remain Incredibly Sycophantic, Resulting in Twisted Effects on Users</a> <font color="#6f6f6f">Futurism</font>
Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT - WSJ
<a href="https://news.google.com/rss/articles/CBMiogNBVV95cUxOUEdqRE9rOUU0Uldvd2xrbkdYd0pqQ3AxVnJ3UG9TNTlVQ3M4NF96T3hVYTloNkZiVGFoM1NUWTJPdkpIUldzVDNRa3JfaWpBWjVNVUR5YkM0SXhRVTRUZEhhVGJHR0lTV1dzb2FkVkVnZnNpcEdVa3M3Tm9wSDhfVnk1MWJDWEZTMmRWcmZzWXVkQXczb010Z1IzNGc5SlA2N0RzX3pQdThiR2J5UlVnZFd3NjFiRkNqQlVwaTN2X0ZWVGZ5bUVqRUhPUWdpUXJUalRKZm1HeWJicF9pbVlQbHVmZUkzYVBpM2NIR1l5SUVnY1R5TnEydlI0R0xfRW9RMHZYNGFnYlNvVEtZRC1leGZ2bndiSl9tZE5seFZsRWtXeFZVMVRRWXFpelBzTVdQeDdYVlR1ckNxcDRJbUFpOUtuNGNkN3A1aHE2R21CQUR3aXQtWnlvWkE1aHdUWFB0d01uRzRaa2JaYnZhRWFjcmptNGttaE9LWTM4WE9yT2p4MjZpSVFiNG1tZERlWnZYXzhxYjROb2ZseENWNW82TFln?oc=5" target="_blank">Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT</a> <font color="#6f6f6f">WSJ</font>
Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT - WSJ
<a href="https://news.google.com/rss/articles/CBMiogNBVV95cUxOdVlCQ2pGTkZxNW5LeWp0UUlmYU5MTm1jMTBtb1M0VVBjTmZYb2VYdjhGR1FHUWNrbVJvT0xNYzJQLXBNY1RTQ2JDUHlBRGZpUzYySG01S0ZOQzhUVjJIUFhYamU5YWNhWU5zRkl6ZkU5SG1NclFmcnN0cHZlZ2VJOGY0Q2x2Y1h6OXk1Nk5PdHl3MEdfOGlvRS1Wajdab1pzamZZdldtVmt5SVlLY2V5SlRkbWlic1J1OXNuYU9JdmxyR2s1WXozS2k4UXhVUmkzSFJfSUJReDk3U0lOVUJWb1BBVkktYW1zbVViRnhZaE40SVNOcXpURUZuQ2dhZ3NxbEdqRkRDc01tWDlONDhhQkt4Z3RhQWthVURoVmRjUzdCU2dZMkRzazdlZ09ST3VQS2piNlZhYjYycTdsZHF3ZmZDdk1CdEVQY0NVWHZrY1YyaHlQblBpOXNPMzdvWXhuWUhpNzloVlBBcnNvVjlJbWs5OTg0Mk8tdTl4eGlzcTI2TjlNUGk0RkVIY3U0azVTREgxenM2S2t4aTBtTTNHYnVR?oc=5" target="_blank">Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT</a> <font color="#6f6f6f">WSJ</font>
Knowledge Map
Connected Articles — Knowledge Graph
This article is connected to other articles through shared AI topics and tags.
More in Models
Paper Finds That Leading AI Chatbots Like ChatGPT and Claude Remain Incredibly Sycophantic, Resulting in Twisted Effects on Users - Futurism
<a href="https://news.google.com/rss/articles/CBMikwFBVV95cUxQWnR0SXhyVm01QXZhUTNsWDNYSFNoNDZnRWpuN3M0Skw5LXJVNFVOSWg4TWRXSEFqY2Zab0M2LWhKV1hZa0xKcDJId19RSW1WRndVREU1TFVZSl8tZ3U1MGk3U2kzWWtDbm9ZWmNMM3R5VFpMdXJ3ZzlHaXZGR2FQbHBqeWFZekppZHdhVTYyU3BnWDA?oc=5" target="_blank">Paper Finds That Leading AI Chatbots Like ChatGPT and Claude Remain Incredibly Sycophantic, Resulting in Twisted Effects on Users</a> <font color="#6f6f6f">Futurism</font>
Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT - WSJ
<a href="https://news.google.com/rss/articles/CBMiogNBVV95cUxOUEdqRE9rOUU0Uldvd2xrbkdYd0pqQ3AxVnJ3UG9TNTlVQ3M4NF96T3hVYTloNkZiVGFoM1NUWTJPdkpIUldzVDNRa3JfaWpBWjVNVUR5YkM0SXhRVTRUZEhhVGJHR0lTV1dzb2FkVkVnZnNpcEdVa3M3Tm9wSDhfVnk1MWJDWEZTMmRWcmZzWXVkQXczb010Z1IzNGc5SlA2N0RzX3pQdThiR2J5UlVnZFd3NjFiRkNqQlVwaTN2X0ZWVGZ5bUVqRUhPUWdpUXJUalRKZm1HeWJicF9pbVlQbHVmZUkzYVBpM2NIR1l5SUVnY1R5TnEydlI0R0xfRW9RMHZYNGFnYlNvVEtZRC1leGZ2bndiSl9tZE5seFZsRWtXeFZVMVRRWXFpelBzTVdQeDdYVlR1ckNxcDRJbUFpOUtuNGNkN3A1aHE2R21CQUR3aXQtWnlvWkE1aHdUWFB0d01uRzRaa2JaYnZhRWFjcmptNGttaE9LWTM4WE9yT2p4MjZpSVFiNG1tZERlWnZYXzhxYjROb2ZseENWNW82TFln?oc=5" target="_blank">Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT</a> <font color="#6f6f6f">WSJ</font>
Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT - WSJ
<a href="https://news.google.com/rss/articles/CBMiogNBVV95cUxOdVlCQ2pGTkZxNW5LeWp0UUlmYU5MTm1jMTBtb1M0VVBjTmZYb2VYdjhGR1FHUWNrbVJvT0xNYzJQLXBNY1RTQ2JDUHlBRGZpUzYySG01S0ZOQzhUVjJIUFhYamU5YWNhWU5zRkl6ZkU5SG1NclFmcnN0cHZlZ2VJOGY0Q2x2Y1h6OXk1Nk5PdHl3MEdfOGlvRS1Wajdab1pzamZZdldtVmt5SVlLY2V5SlRkbWlic1J1OXNuYU9JdmxyR2s1WXozS2k4UXhVUmkzSFJfSUJReDk3U0lOVUJWb1BBVkktYW1zbVViRnhZaE40SVNOcXpURUZuQ2dhZ3NxbEdqRkRDc01tWDlONDhhQkt4Z3RhQWthVURoVmRjUzdCU2dZMkRzazdlZ09ST3VQS2piNlZhYjYycTdsZHF3ZmZDdk1CdEVQY0NVWHZrY1YyaHlQblBpOXNPMzdvWXhuWUhpNzloVlBBcnNvVjlJbWs5OTg0Mk8tdTl4eGlzcTI2TjlNUGk0RkVIY3U0azVTREgxenM2S2t4aTBtTTNHYnVR?oc=5" target="_blank">Exclusive | The Sudden Fall of OpenAI’s Most Hyped Product Since ChatGPT</a> <font color="#6f6f6f">WSJ</font>
datasette-llm 0.1a6
<p><strong>Release:</strong> <a href="https://github.com/datasette/datasette-llm/releases/tag/0.1a6">datasette-llm 0.1a6</a></p> <blockquote> <ul> <li>The same model ID no longer needs to be repeated in both the default model and allowed models lists - setting it as a default model automatically adds it to the allowed models list. <a href="https://github.com/datasette/datasette-llm/issues/6">#6</a></li> <li>Improved documentation for <a href="https://github.com/datasette/datasette-llm/blob/0.1a6/README.md#usage">Python API usage</a>.</li> </ul> </blockquote>

Discussion
Sign in to join the discussion
No comments yet — be the first to share your thoughts!