Quickstart
aigw is an OpenAI-compatible, governed AI gateway: point any OpenAI SDK at one base URL, use a virtual key, and reach every model behind a single contract - with per-key budgets, DLP, and a full audit log.
Zero to your first completion in three steps. Everything past step 1 is copy-paste, then governance is a 60-second add-on.
1. Get a key
Virtual keys are created in the console (you need a browser once for the magic-link sign-in):
- console.aigw.app → sign in.
- API keys → New key.
- Set a monthly budget (in cents) and, optionally, an allow-list of models.
- Copy the
aigw_…secret - it’s shown exactly once.
A virtual key is not a provider key. It’s your key, scoped and capped by you; aigw resolves it to the right upstream provider on each request.
2. Point your OpenAI client here
The base URL is https://gateway.aigw.app/v1 (or your own gateway host).
Use the virtual key as the bearer. Any OpenAI-compatible SDK works
unchanged - only base_url and api_key change.
curl:
curl https://gateway.aigw.app/v1/chat/completions \
-H "Authorization: Bearer aigw_…" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt",
"messages": [{"role": "user", "content": "Hello from aigw"}]
}'
OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.aigw.app/v1",
api_key="aigw_…",
)
resp = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Hello from aigw"}],
)
print(resp.choices[0].message.content)
OpenAI Node SDK:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gateway.aigw.app/v1",
apiKey: "aigw_…",
});
const resp = await client.chat.completions.create({
model: "gpt",
messages: [{ role: "user", content: "Hello from aigw" }],
});
console.log(resp.choices[0].message.content);
That is the whole integration. Streaming, embeddings
(POST /v1/embeddings), and the model list (GET /v1/models) all work
the same way.
3. Switch models without changing code
Change the model string to route to a different provider. The same
request shape reaches OpenAI-, Anthropic-, and OpenAI-compatible
providers - aigw translates as needed.
resp = client.chat.completions.create(
model="mistral-large", # was claude-sonnet-4-6
messages=[{"role": "user", "content": "Same code, different model."}],
)
Add governance in 60 seconds
Everything above already runs through per-key budgets, DLP redaction, and a sealed audit log. To govern what your agents may do, add these in the console - each takes about a minute:
- Register a tool. In Tools, add an MCP server by URL. aigw introspects the tools it exposes so you govern real tool and argument names, not blind globs.
- Register an agent. In Agents, add an agent-to-agent (A2A) endpoint. aigw reads its capability card so delegation is governed by what the agent can actually do.
- Set a guardrail or approval. On any tool or agent, set a rule to
allow, deny, or approve - argument-level constraints and
rate limits included.
approveholds the call for a human decision.
See the full walkthrough in agentic governance - tools & A2A.
What happens on every request
- Your virtual key is authenticated and rate-limited.
- The model allow-list and monthly budget are enforced - over budget
returns
402. - DLP redacts configured PII before the request leaves your tenant.
- Any tool or agent call is checked against your policy (allow / deny / approve).
- The request is forwarded to the best healthy provider (with automatic failover + retries) and metered.
- A sealed record lands in your audit log.