aigwdocs

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

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 needValue
OpenAI-compatible base URLhttps://gateway.aigw.app/v1
Anthropic-native base URLhttps://gateway.aigw.app (the tool appends /v1/messages)
API keyyour aigw virtual key, aigw_…, from Console -> API keys
Modela 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:

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:

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”:

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:

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.