Skip to content
Self-hosted AI gateway

All your AI traffic, in plain sight.

One OpenAI-compatible API for every provider: routing, budgets, guardrails and costed traces, on your own infrastructure.

POST /v1/chat/completionsillustration
openai 429 → fallback bedrock · 2001 answer back
220 µs
p99 latency added per request
23,654
requests per second on four cores, no failures
54.6 MiB
memory under load
24
client-to-provider format pairs measured
Request logsLast 24 hours · illustrative data
StatusTimePrincipalTeamModelProviderLatencyCost
20012:00:04checkout-serviceplatformchat-defaultopenai185 ms$0.0021
20012:00:03support-agentsupportclaude-fastanthropic412 ms$0.0064
42912:00:03batch-summariesdatachat-defaultopenai → bedrock903 ms$0.0048
20012:00:02search-reranksearchembed-smallcohere61 ms$0.0001
20012:00:01ide-assistantplatformcode-largevertex1.24 s$0.0312
40312:00:01intern-notebookdatacode-large—2 ms$0.0000
20012:00:00checkout-serviceplatformchat-defaultcache4 ms$0.0000

Row 3: the provider answered 429 and the fallback served it. Row 6: the key's policy does not allow that model, so nothing left the building.

The console ships inside the gateway, at /ui/. These views are drawn from its screens; the rows are made up.

Drop-in

One SDK, any model.

Point the OpenAI SDK or curl at the gateway. Each model name is an alias your operator defines, running on OpenAI, Anthropic, Gemini, Bedrock, Cohere or any OpenAI-compatible provider.

app.py
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",   # your gateway    api_key=GATEWAY_KEY,   # a gateway key, never a provider's)

# Aliases your operator defines; each one can run on a different provider.
for model in ["gpt-5", "claude-sonnet", "gemini-pro"]:    client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": "Hello"}],
    )
How it works

From the first provider to production.

Every step runs inside m7gtw, on the same traffic, ledger and permissions.

Start
1

Connect providers

129 presets, OpenAI, Anthropic, Gemini, Vertex AI, Bedrock, Azure, Mistral, Groq and Cohere among them. Provider keys stay in the gateway.

/docs/features/feature-providers/
2

One API for your apps

Apps call one alias with the OpenAI SDK, or keep Anthropic, Responses or Gemini code. Four client dialects reach six provider dialects.

/docs/features/protocol-translation/
3

Route and fall back

Weights, sticky canaries, latency and health-aware ordering, retries and circuit breakers, plus exact and semantic cache, changed without a deploy.

/docs/features/feature-routing/
4

Budgets and limits

Budgets and token limits per team, key and end user are checked before any provider call. Spend stops at the limit, not at the invoice.

/docs/features/budgets-and-tpm/
5

Guardrails and privacy

Mask personal data, block requests, enforce a system prompt. Logs and spans hold metadata only; prompts are kept only under a policy you enable.

/docs/features/feature-guardrails/
6

Traces and logs

Each request is a tree of timed, costed spans in the gateway's own PostgreSQL. Coding-agent runs are grouped from the traffic itself.

/docs/features/traces/
7

Evaluate quality

Datasets, experiments and judges on real traffic. Judge calls are routed, budgeted, priced and linked both ways to what they judged.

/docs/features/feature-evals/
8

Analytics and cost

An automatic price book prices every provider attempt, retries and fallbacks included, by team, key and model. Metrics and alerts export over OTLP.

/docs/features/usage-valuation/
9

Teams and organizations

Organizations cap the models their teams may use; custom roles, SSO with OIDC, SCIM and an audit trail. MCP tools and A2A agents use the same keys.

/docs/features/organizations/
In production
DeploymentOne Go binary with the console built in, plus PostgreSQL; Compose, a native binary or Kubernetes. No request passes through our servers./docs/operate/deployment-modes/
Performance

Seven gateways, one instrument.

Our private run of the public On the Bench method: other gateways on 30–31 October 2026, m7gtw on 19 November 2026, on new boxes of the same type with the same instrument, where the October build of m7gtw first reproduced its October numbers.

m7gtw adds 220 µs at p99 and carries 23,654 req/s on four cores.

Busbar leads this cell at 92 µs and 59,039 req/s; the other five are slower.

  1. Busbar 1.5.592
  2. m7gtw220
  3. Bifrost v1.6.111,211
  4. GoModel 0.1.822,713
  5. Portkey 1.15.23,741
  6. LiteLLM · Python v1.98.07,656
  7. One-API v0.6.10≈1.4 s

The headline cell is openai → openai: an OpenAI client calling an OpenAI-compatible upstream.

Quickstart

Running in about ten minutes.

Docker Compose starts the gateway, PostgreSQL and an OpenTelemetry Collector on your machine.

1

Start it

Clone the repository, build the image (until the first public release), write the local secrets with your OpenAI key in OPENAI_API_KEY, and start the services; the first start runs the migrations.

/docs/start/quickstart/

Also runs as a single binary, with npx, or on Kubernetes (Helm or Kustomize).

git clone https://github.com/m7gtw/gateway.git m7gtw && cd m7gtw
export GATEWAY_IMAGE=gateway:local
scripts/build-image.sh "$GATEWAY_IMAGE"
python3 scripts/bootstrap-local-secrets.py --target docker
docker compose --env-file deploy/docker/.env.local \
  -f deploy/docker/compose.yaml up --no-build -d --wait
2

Send the first request

chat-default routes to an OpenAI model in the example configuration.

/docs/start/quickstart/
curl http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"chat-default","messages":[{"role":"user","content":"Hello!"}]}'
3

Open the console

Sign in with the admin token, find the call in Logs → Requests, create an app key.

/docs/features/console/
http://localhost:8080/ui/
Documentation

Start from the docs.

For agents and LLMs: /llms.txt indexes the site and the docs, /docs/llms-full.txt holds the docs in one file, and every page has a .md twin.

m7 ai

Ask m7 ai about the gateway.

m7 ai answers only about m7gtw, from the docs, citing the page. It never runs commands or acts for anyone.

It runs on the open-weight gpt-oss-20b model on Cloudflare Workers AI, with a daily limit. Questions are not stored.

m7 ai
Only about m7gtw, only from the docs
What happens when a team reaches its budget?
The gateway refuses the request before calling the provider, so nothing more is spent. The refusal appears in the request log with the team and the key./docs/features/budgets-and-tpm/
Can you write a poem about my cat?
I only answer questions about m7gtw. Try routing, keys, budgets or the console.
Do not type personal data. Questions are not stored; a refused one is logged only as a hash.
Editions

One core, two editions.

Both editions are the same binary. Enterprise turns on with a signed licence key, checked locally with no network call.

Shared core

Shared core

The gateway and its console, from one Go binary and PostgreSQL.

Enterprise

Enterprise

The same binary with an Enterprise licence key. A 14-day trial key is supported.

Write to uscontact@m7gtw.com

What each edition includes, prices and support terms are not published yet. Write to us and we will tell you where things stand.

FAQ

Questions people ask first.

What is m7gtw?

A self-hosted AI gateway in Go: one OpenAI-compatible API with routing, budgets, guardrails, traces and evaluations, for teams with roles and permissions.

How fast is it, and is it the fastest?

No. On openai → openai it adds 220 µs at p99 (build of 19 November 2026); Busbar adds 92 µs. The other five were slower.

Where does it run, and where does my data go?

On your infrastructure, next to your PostgreSQL. Requests go from your apps to the gateway to your providers, never through our servers.

Do I have to change my code?

Only the base URL and the key. Use the OpenAI SDK for every model; existing Anthropic, Responses or Gemini code works too.

How were the numbers measured?

A private run of the public On the Bench method, each gateway on its own AWS m7g.4xlarge. Report, kit and raw data are in the docs.

What do the editions cost?

Prices are not published yet; write to contact@m7gtw.com.

What does m7 ai answer?

Questions about m7gtw, from the docs, with a link to the page. Nothing else.

Contact

Tell us what you are routing.

Editions, deployments or the benchmark: we answer by e-mail.

contact@m7gtw.com
Bot check (Cloudflare Turnstile). It loads when you start typing.
What the form keeps: Privacy