DEV Community

Daniel Dong
Daniel Dong

Posted on

Your API key is a spending limit. Treat it like one.

The scariest thing about wiring an LLM into your product isn't the prompt — it's the moment a key leaks into a public repo and the meter starts running without you.

curl https://aibridge-api.com/v1/chat/completions \
  -H "Authorization: Bearer mb-xxxxxxxx" \
  -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"..."}]}'
Enter fullscreen mode Exit fullscreen mode

One key, one meter, and — the important part — hard limits that actually stop requests, not polite warnings you find out about in next month's invoice.


The bill-explosion problem

Every LLM horror story follows the same script: a key gets committed to GitHub, a bot scrapes it, and someone wakes up to a four-figure bill. The key was never meant to be a blank check, but on most platforms, that's exactly what it is.

The problem isn't just the leak. It's the lack of a blast radius:

  • No hard quota → a leaked key can spend until you notice
  • No rate limit → a runaway retry loop can drain you in hours
  • Per-vendor keys → four keys means four leak surfaces, four places to rotate

Security that's boring on purpose

AIBridge puts guardrails in front of the models, so a key can't act like an unlimited credit card:

  • Per-token atomic quota — a hard ceiling that stops the request, not just flags it after the fact
  • Rate limiting — caps requests-per-window so a buggy loop can't spiral
  • One key, not four — a single mb- credential for all 15 models, so there's one thing to rotate when you need to
  • Usage dashboard with a live bar — you see your spend as it happens, not at reconciliation time

The goal: if something goes wrong, the damage is a bounded number you set — not a surprise you discover.

The habits that pair with it

The tools only help if you use them like you mean it:

  1. Never hardcode the key — pull it from process.env / secrets manager, always
  2. Rotate on any suspicion — with one key, rotation is a five-minute job instead of a five-account ordeal
  3. Set your quota deliberately — leave headroom for growth, but not for catastrophe
  4. Watch the dashboard weekly — a usage bar that climbs unexpectedly is your earliest alarm

That's the whole security posture. No custom middleware, no WAF config, no SOC-2 audit — just sane defaults baked into the endpoint.

What's behind the key

15 models across 4 vendors, all callable with that single credential:

  • DeepSeekdeepseek-v4-pro, deepseek-v4-flash, deepseek-reasoner, deepseek-coder, deepseek-chat
  • Qwenqwen3-235b-a22b, qwen-plus, qwen-max
  • GLMglm-4-plus, glm-4-air, glm-4-flash
  • Moonshotkimi-k3 (1M context), moonshot-v1-128k / -32k / -8k

Pricing with a ceiling built in

  • Free tier: 500K tokens/month (weighted)
  • Pro: $9.90/month for 5M tokens
  • Top-ups: 1M / $2.99 · 5M / $9.90 · 20M / $29.90 (never expire)

The takeaway

A leaked key should cost you a rotation, not a mortgage payment. Put your spend behind a real limit and get back to building.

One key. Hard limits. Fifteen models.

aibridge-api.com · support@aibridge-api.com

1

2

3

4

Top comments (0)