Coding agents & IDEs
Coding agents are the ideal thing to put behind aigw. They re-send huge, mostly-unchanged context on every call (the open files, the repo map, the running conversation), so prompt caching alone cuts a large share of the input cost - and you get the full governance stack for free: audit, secret/exfil scanning, model allow-lists, budget caps, and approvals.
Best of all there is nothing to rebuild. Every popular coding tool lets you set a base URL and an API key. Point those two settings at aigw and you are done.
Why route your coding tool through aigw
- Cost. Coding agents repeat their context constantly. Prompt caching
on the repeated prefix saves up to about half the input cost on those
calls. In one measured run, 91% of a 1,681-token prefix was served from
cache, cutting roughly 65% of that call’s input cost on
gpt-4.1-mini. Your mileage varies with how much context repeats, but for coding agents it repeats a lot. - Governance, at no extra effort. Every call is audited. Output and input are scanned for secrets and exfil. A key can be pinned to an allow-list of models, capped with a monthly budget, and gated with approvals. See Budgets, DLP & audit and agentic governance.
- No SDK change. You are not rewriting the tool. You change a base URL and a key.
The universal pattern
This is the whole trick. Any tool that lets you set an OpenAI-compatible or an Anthropic base URL plus an API key can route through aigw.
| You need | Value |
|---|---|
| OpenAI-compatible base URL | https://gateway.aigw.app/v1 |
| Anthropic-native base URL | https://gateway.aigw.app (the tool appends /v1/messages) |
| API key | your aigw virtual key, aigw_…, from Console -> API keys |
| Model | a model enabled on that key (see Providers & models) |
Use the /v1 form for anything that speaks the OpenAI API. Use the
bare host for tools that speak the Anthropic Messages API natively and
append /v1/messages themselves. The virtual key is your aigw_…
secret; it is shown once when you create the key.
One caveat that applies to every tool below: the model string you set
must be a model that is enabled on your key. If a model is not on the key’s
allow-list, the call is rejected. Check available model ids in the console
or with GET /v1/models.
Per-tool setup
Cursor
Cursor supports an OpenAI-compatible override. In Settings -> Models, enable OpenAI API Key, then set:
- Override base URL:
https://gateway.aigw.app/v1 - API key: your
aigw_…virtual key - Add a custom model whose name matches a model enabled on your key.
Cursor validates the key against the base URL you set, so verify with a model you know is enabled. Cursor’s own routing for some features can be opinionated; if a given feature ignores the custom endpoint, that is a Cursor behavior - see Cursor’s model docs.
Claude Code
Claude Code speaks the Anthropic API and honours standard environment variables. Point it at the bare gateway host and use your aigw key:
export ANTHROPIC_BASE_URL="https://gateway.aigw.app"
export ANTHROPIC_API_KEY="aigw_…"
Claude Code appends /v1/messages itself, so use the bare host (no
/v1). Set the model to an Anthropic model that is enabled on your key.
OpenAI Codex CLI
Codex CLI reads the standard OpenAI environment variables:
export OPENAI_BASE_URL="https://gateway.aigw.app/v1"
export OPENAI_API_KEY="aigw_…"
Set the model to one enabled on your key. Codex CLI’s config file also accepts a custom base URL / provider if you prefer file config over env; see the Codex CLI docs for the exact key names in your version.
Cline / Roo Code (VS Code)
Both are VS Code agents with an explicit provider picker. Choose the OpenAI Compatible provider (or the Anthropic provider) and set:
- Base URL:
https://gateway.aigw.app/v1for OpenAI Compatible, orhttps://gateway.aigw.appfor the Anthropic provider. - API Key: your
aigw_…virtual key. - Model: a model enabled on your key (for OpenAI Compatible you type the model id directly).
Continue.dev
Continue models take an apiBase. In your Continue config, add a model
with the OpenAI-compatible or Anthropic provider and set apiBase to the
gateway plus your key. YAML config form:
models:
- name: aigw-gpt
provider: openai
model: gpt-4.1-mini # a model enabled on your key
apiBase: https://gateway.aigw.app/v1
apiKey: aigw_…
For an Anthropic-native model use provider: anthropic and
apiBase: https://gateway.aigw.app. If you are on the older JSON
config.json, the same fields apply (apiBase, apiKey, model); see
the Continue docs for your version’s shape.
Aider
Aider follows the underlying provider’s environment variables. For an OpenAI-compatible route:
export OPENAI_API_BASE="https://gateway.aigw.app/v1"
export OPENAI_API_KEY="aigw_…"
aider --model gpt-4.1-mini # a model enabled on your key
You can also pass --openai-api-base https://gateway.aigw.app/v1 on the
command line. For an Anthropic route, set ANTHROPIC_API_BASE /
ANTHROPIC_API_KEY to the bare host and your key. Aider uses LiteLLM
under the hood, so prefix the model as that provider expects; see the
Aider docs.
Windsurf, Zed, Goose
These vary in how much custom-endpoint support they expose, so treat this as “use the pattern if the setting exists”:
- Zed supports custom OpenAI-compatible providers with an
api_urlin its assistant/agent settings - set it tohttps://gateway.aigw.app/v1and use youraigw_…key. Confirm the exact field in the Zed docs. - Goose (Block’s agent) supports OpenAI-compatible and Anthropic providers with a configurable host; point the host at the gateway and use your key. See the Goose docs.
- Windsurf: custom base-URL support has varied by version and plan. If your build exposes a custom OpenAI-compatible base URL, use the pattern above; if it does not, it cannot be routed today. Check the Windsurf docs for your version.
If a tool lets you set a custom OpenAI-compatible (or Anthropic) base URL and key, the pattern above works. If it does not, it cannot be routed.
Generic: any OpenAI or Anthropic SDK
Anything built on the OpenAI or Anthropic SDK just needs base_url:
# OpenAI SDK
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.aigw.app/v1",
api_key="aigw_…",
)
# Anthropic SDK
from anthropic import Anthropic
client = Anthropic(
base_url="https://gateway.aigw.app",
api_key="aigw_…",
)
// OpenAI SDK (Node)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gateway.aigw.app/v1",
apiKey: "aigw_…",
});
// Anthropic SDK (Node)
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic({
baseURL: "https://gateway.aigw.app",
apiKey: "aigw_…",
});
A limitation worth stating plainly
Some tools do not let you set a custom API endpoint, so they cannot be routed through aigw today. GitHub Copilot is the notable one: it does not expose a custom base URL for its model calls, so there is no supported way to point it at aigw. We would rather say that than invent a config that does not exist. If a tool has no base-URL setting, it cannot be routed until the vendor adds one.
What you get
Once a tool runs through aigw, every call picks up:
- Prompt-cache savings on the repeated context coding agents send each turn - the main cost win here.
- Exact-cache / dedup on identical repeat requests.
- Audit log - every call recorded with subject, model, and cost.
- Exfil / DLP scanning on inputs and outputs for secrets and sensitive data.
- Per-key budgets - a hard monthly spend cap per key.
- Model allow / deny - pin a key to only the models you approve.
- Approvals - hold sensitive tool calls for a human decision.
- Model routing - policy-driven model selection (coming).
More detail: agentic governance · Budgets, DLP & audit · Data-plane API reference.
Verify it is working
After you point a tool at aigw, make one call from it, then open Console -> Logs: your call appears there with its model, subject, and cost. Over a session, the Overview / savings view shows prompt-cache and exact-cache savings accruing as your agent re-sends context. If calls are not showing up, the tool is not actually using the custom base URL - recheck the base URL and key in its settings.