ModelGate is a drop-in gateway in front of OpenAI, Anthropic, Google and Azure. Change one base URL and every request is logged, priced to the token, and audited for waste — with optional automatic caching and model routing.
Four steps, about five minutes:
Every request carries your ModelGate API key in the x-api-key header. The key identifies your project; provider keys are looked up server-side, so no provider secret ever leaves your dashboard.
x-api-key: mg_live_xxxxxxxxxxxxxxxxxxxxxxxxKeys can be revoked any time from the dashboard; a revoked key stops working immediately.
The gateway speaks the OpenAI Chat Completions format at POST https://gw.modelgatehq.com/v1/chat/completions. Send the same body you’d send to OpenAI — model and messages — and ModelGate forwards it to whichever provider owns that model, using your stored key.
curl https://gw.modelgatehq.com/v1/chat/completions \
-H "content-type: application/json" \
-H "x-api-key: $MODELGATE_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Ping"}]
}'from openai import OpenAI
client = OpenAI(
base_url="https://gw.modelgatehq.com/v1",
api_key="unused", # ignored; ModelGate uses x-api-key
default_headers={"x-api-key": "YOUR_MODELGATE_KEY"},
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Ping"}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gw.modelgatehq.com/v1",
apiKey: "unused",
defaultHeaders: { "x-api-key": process.env.MODELGATE_API_KEY },
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Ping" }],
});The response comes back in the same OpenAI shape regardless of which provider served it, so anything that parses a Chat Completions response keeps working.
Use the provider’s own model name. Prices below are per million tokens, for reference.
| Provider | Model | Input / 1M | Output / 1M |
|---|---|---|---|
| OpenAI | gpt-4o | $2.50 | $10.00 |
| OpenAI | gpt-4o-mini | $0.15 | $0.60 |
| Anthropic | claude-sonnet-5 | $3.00 | $15.00 |
| Anthropic | claude-haiku-4-5 | $1.00 | $5.00 |
gemini-2.5-pro | $1.25 | $10.00 | |
gemini-2.5-flash | $0.30 | $2.50 |
Pricing is stored in a versioned rate table and used to cost every request exactly — no estimates, no sampling. Rates change; the dashboard always reflects the table in force at the time of each call.
ModelGate watches your traffic for two kinds of waste and can act on them. Each is configured per project in Settings, and each has a safe middle setting that only recommends before it ever changes a request.
Identical, deterministic requests (same model, same messages, temperature 0) can be served from a cache instead of paying the provider again.
OFF — never cache.RECOMMENDATION_ONLY — measure how much caching would save, change nothing.AUTO — serve repeats from cache. A cache hit costs $0; the saving is what the original call cost.When a small, simple call is running on a premium model, ModelGate can route it to a cheaper model that does the same job.
OFF / RECOMMENDATION_ONLY — leave requests untouched; flag candidates.SAFE_AUTO — downgrade only clear-cut cases, with legal/medical/financial/security prompts protected.AGGRESSIVE_AUTO — downgrade wherever the heuristics find a cheaper model that fits.The savings from automatic caching and downgrades are what we call realized savings — measured at the gateway, shown on your dashboard, and the basis for the success fee.
The gateway can inspect traffic in both directions and act on it. Each category is a per-project setting in Settings with three levels — the same OFF → DETECT → ENFORCE ladder as the optimizations. Detect logs incidents to the Security page without changing any request; Enforce blocks or redacts. Incidents are stored with a masked snippet only — the raw secret or PII value is never persisted.
ENFORCE refuses a high-risk request with 403 blocked_by_guardrails before it reaches a provider.ENFORCE redacts them from the response.ENFORCE masks them before the response is returned.DETECT is available on every plan. ENFORCE (active blocking/redaction) is a paid capability, like the automatic optimizations.
Managed at the gate, before you’re billed by a provider. Set them per project in Settings:
402 until the cap is raised or the month rolls over.| Status | Meaning |
|---|---|
401 | Missing or invalid ModelGate API key. |
402 | Monthly spend cap reached, or a billable optimization used after the trial without a Pro plan. |
403 | Blocked by guardrails — the request tripped the prompt-injection shield in enforce mode. |
429 | Rate limit exceeded for the key. |
4xx / 5xx | Passed through from the upstream provider, or a gateway error. The body carries the detail. |
Every account starts with a 3-month free trial — the full product, no card, no charge. After that, Pro is $99/month plus 30% of the savings the gateway realizes for you. If nothing is saved, there’s nothing to pay beyond the base.
The $99 base is a PayPal subscription. The 30% success fee is billed once a month as a separate PayPal invoice for 30% of that month’s realized savings. Full detail is on your dashboard’s Billing page. See also the Terms and Privacy Policy.
Email support@modelgatehq.com and we’ll help you get set up.