cd /news/developer-tools/i-built-an-openai-compatible-gateway… · home topics developer-tools article
[ARTICLE · art-60700] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

I Built an OpenAI-Compatible Gateway to Control LLM Costs

An indie developer built CostLLM, an OpenAI-compatible API gateway that sits between code and LLM providers to control costs. The gateway offers per-project spending visibility, cost caps per feature, and rate limit management without vendor lock-in. It supports models like deepseek-v4-flash, deepseek-v4-pro, deepseek-chat, and deepseek-reasoner.

read1 min views1 publishedJul 15, 2026

As an indie developer building AI products, I kept hitting the same wall: how do I control LLM costs without vendor lock-in?

Direct API keys meant zero visibility into per-project spending. Month-end surprise bills. No way to cap costs per feature. Rate limit headaches.

So I built CostLLM — an OpenAI-compatible API gateway that sits between your code and the LLM provider.

client = OpenAI(api_key="sk-proj-...")

client = OpenAI(
    base_url="https://api.costllm.ai/v1",
    api_key="YOUR_COSTLLM_API_KEY"
)
Model Type
deepseek-v4-flash Fast chat
deepseek-v4-pro Complex reasoning
deepseek-chat General purpose
deepseek-reasoner Deep analysis

Building a production API gateway taught me a lot about concurrency, streaming, error handling, and payment webhooks. The hardest part wasn't the code — it was designing a pricing model that works for both free users and growing teams.

I'd love feedback from other developers working with LLM APIs — especially around cost visibility, key management, and what you'd want from a gateway.

── more in #developer-tools 4 stories · sorted by recency
── more on @costllm 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-an-openai-co…] indexed:0 read:1min 2026-07-15 ·