LLMCostGuard
Keep OpenAI bills predictable.
After payment you get an email with your download link within a few minutes. The link is valid for 7 days.
Digital goods. If a tool doesn't work as described, we fix it or refund you — see Terms.
Key features
- OpenAI-style /v1/chat/completions endpoint; users via X-User-ID header or API-key hash
- One-hour cache for identical prompts, optional Groq fallback
- Prometheus /metrics with a Grafana dashboard
requirements.txt — no third-party packages needed
What's in the ZIP
- README.md — up and running in under a minute
- main.py — complete, readable source code
- requirements.txt — no third-party packages needed
Why PyForge: Ready-made tools with full source code.
More details
Keep OpenAI bills predictable. LLMCostGuard is a self-hosted proxy that counts the tokens of every call and refuses requests once a user reaches a daily or monthly budget. - OpenAI-style /v1/chat/completions endpoint; users via X-User-ID header or API-key hash - One-hour cache for identical prompts, optional Groq fallback - Prometheus /metrics with a Grafana dashboard Runs with: Python 3, zero dependencies. Budgets live in memory and reset on restart.
# Start the proxy with a 25 USD default budget per user
python main.py serve --port 8080 --default-budget 25
# Point your OpenAI client at the proxy
curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" -H "X-User-ID: user_42" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hi"}]}'Quick Start
Runs on Python 3.9 or newer with the standard library only. Nothing to pip install.
1 — Run it
python main.py --helpHow agents & programs use it: It uses only the Python standard library, so scripts and AI agents can run it as a subprocess without extra installs.
Why developers buy from PyForge
- Save hours: ready-made, tested tools. Skip writing, debugging and maintaining it yourself.
- Ready in minutes: one file, drop it in your project and run it.
- Mostly zero-dependency: no pip install chains, no supply-chain risk.
- Full source code: readable, auditable, yours to modify.
- Runs locally and offline: no account, no API key, no data leaves your machine.
- Pay once, own it: no subscription.
- Tested before release: every tool is checked before it goes on sale.
All-Access Pass
Get every PyForge tool with the All-Access Pass
48 tools today plus every future release, lifetime commercial license, one payment of $99.
This tool: $39 · All 48 tools: $99
See the All-Access Pass