๐—œ ๐—–๐˜‚๐˜ ๐— ๐˜† ๐—”๐—œ ๐—”๐—ฃ๐—œ ๐—–๐—ผ๐˜€๐˜๐˜€ ๐—•๐˜† ๐Ÿณ๐Ÿฌ%

My OpenAI bill jumped from $30 to $150. A small Slack bot caused this. Repeated prompts and retries cost too much.

I tried simple fixes. I used basic caching. I switched models. Nothing worked. Users rephrase questions. Basic caching fails when words change.

I built an AI proxy. It sits between my app and the API. It does three things:

This cut my costs by 70%.

There are trade-offs:

Lessons for you:

Stop treating AI APIs as black boxes. They are HTTP endpoints. Use middleware to control them.

What is your setup? Do you use a service or build your own?

Source: https://dev.to/__c1b9e06dc90a7e0a676b/i-built-a-simple-ai-proxy-to-cut-api-costs-heres-what-i-learned-3hcf