Documentation

BudgetForge is a drop-in proxy that enforces hard budget limits on your LLM API calls. No code changes needed — just swap the base URL.

Quick start

1. Get your BudgetForge key from the portal. 2. Replace your provider base URL with the BudgetForge proxy URL. 3. Pass your original provider key as X-Provider-Key.

Python / OpenAI SDK

import openai

client = openai.OpenAI(
    api_key="YOUR-BUDGETFORGE-KEY",
    base_url="https://llmbudget.maxiaworld.app/proxy/openai/v1",
    default_headers={"X-Provider-Key": "YOUR-OPENAI-KEY"},
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
)

Anthropic SDK

import anthropic

client = anthropic.Anthropic(
    api_key="YOUR-BUDGETFORGE-KEY",
    base_url="https://llmbudget.maxiaworld.app/proxy/anthropic",
    default_headers={"X-Provider-Key": "YOUR-ANTHROPIC-KEY"},
)

Cursor / n8n / any OpenAI-compatible tool

API Key:  YOUR-BUDGETFORGE-KEY
Base URL: https://llmbudget.maxiaworld.app/proxy/openai

Supported providers

ProviderProxy pathPlan
OpenAI/proxy/openai/v1/…Free+
Anthropic/proxy/anthropic/…Free+
Google AI/proxy/google/…Pro+
DeepSeek/proxy/deepseek/…Pro+
Ollama (local)/proxy/ollama/…Free+

Python SDK

Drop-in SDK — no extra setup required.

pip install budgetforge

LLM (simple prompt)

from budgetforge import BudgetForgeLLM

llm = BudgetForgeLLM(api_key="YOUR-BUDGETFORGE-KEY")
print(llm.invoke("Summarize this in one sentence: ..."))

Chat (messages list)

from budgetforge import BudgetForgeChat

chat = BudgetForgeChat(api_key="YOUR-BUDGETFORGE-KEY", provider="anthropic")
result = chat.invoke([
    {"role": "user", "content": "Hello!"}
])
print(result["content"])

LangChain integration

pip install langchain-budgetforge
from langchain_budgetforge import BudgetForgeLLM

llm = BudgetForgeLLM(api_key="YOUR-BUDGETFORGE-KEY")
result = llm.invoke("Write a haiku about tokens.")
print(result)

Webhooks (Pro+)

BudgetForge sends a POST to your webhook URL when a budget threshold is hit.

# Payload example
{
  "event": "budget.threshold",
  "project_id": "proj_xxx",
  "budget_used_pct": 90,
  "budget_usd": 10.00,
  "spent_usd": 9.02,
  "timestamp": "2026-04-24T14:00:00Z"
}

Configure webhooks in your project settings.

API reference

POST/proxy/{provider}/v1/chat/completions

Forward a chat completion request through BudgetForge. Identical body to the provider API.

GET/api/usage

Returns calls used and budget consumed for the authenticated project.

GET/health

Health check. Returns {"status": "ok"} with HTTP 200.

All requests require Authorization: Bearer YOUR-BUDGETFORGE-KEY.