MIGRATION GUIDE

From direct API calls to one governed endpoint

Most teams start by calling OpenAI or Anthropic straight from their applications, with a provider key in each service's environment. That is the right way to start. This guide is for when it stops being enough: you move each application behind Wäg one at a time, without rewriting it, and every step can be undone by changing one line back.

What changes

  • The base URL each application sends requests to
  • The key it sends: a gateway key per application instead of the provider key
  • Where provider keys live: in Wäg, not in every service

What doesn't

  • Your SDK — openai, langchain, llamaindex and the rest
  • Your prompts, request shapes and response handling
  • Streaming, tool calling, vision and structured output
  • The model names your code already uses
  • Your provider accounts and contracts

Not sure you need a gateway yet? This explains what one does, and when calling the provider directly is still the better choice: What is an AI gateway?

THE PATH

Five steps, one application at a time

1 · Run Wäg and add your providers

Give each provider your existing account and name the aliases after the model names your code already sends. Then no model reference in any application has to change.

# waeg.yaml — aliases named after the models your code already asks for
providers:
  openai:
    provider: openai
    api_key_env: OPENAI_API_KEY
  anthropic:
    provider: anthropic
    api_key_env: ANTHROPIC_API_KEY

models:
  - name: gpt-4o
    deployments:
      - provider: openai
        model_id: gpt-4o

  - name: claude-haiku-4-5
    deployments:
      - provider: anthropic
        model_id: claude-haiku-4-5

Keys are resolved from the environment or your vault, never written into the file.

2 · Issue one gateway key per application

Each application gets its own virtual key instead of the provider key. That is what makes cost per application, limits per team and revoking a single service possible — none of which a shared provider key can do.

3 · Change the base URL and the key

Wäg serves the OpenAI-compatible surface — chat completions, the Responses API (stateless), embeddings, images, audio, video, OCR, moderations, rerank, files, batches, realtime and models — with true SSE streaming, plus /v1/mcp and /v1/a2a for agents. In the application, two lines change:

  client = OpenAI(
-     api_key=os.environ["OPENAI_API_KEY"],
+     base_url=os.environ["WAEG_BASE_URL"],   # e.g. https://waeg.internal/v1
+     api_key=os.environ["WAEG_KEY"],         # this application's gateway key
  )

Applications built on Anthropic's or Gemini's own SDKs are supported too: /v1/messages and Gemini's /v1beta are first-class request shapes, not only translations of the OpenAI shape.

4 · Check, then move the next application

Send one normal, one streaming and one tool-calling request, and read the response headers: x-waeg-routed-model says which model served it, x-waeg-route-reason why (with intelligent routing), x-waeg-cache whether a cache answered. The request is already in the console with its tokens and cost.

A reasonable order: internal tools first, then batch and offline workloads, then one production service, then the rest.

5 · Take the provider keys out of the applications

When every application goes through Wäg, rotate the provider keys and delete them from application environments, CI secrets and config files. From then on, only Wäg holds them — which is most of the security gain, and the step teams most often forget.

How to roll back

Change the base URL and the key back. Wäg holds no state your applications depend on, so until step 5 that is the whole procedure. Do step 5 last, once you are sure — after it, rolling back means issuing provider keys to applications again.

AFTERWARDS

What you gained

  • Cost per application, team and user, as it happens — not reconstructed from an invoice.
  • Budgets that stop spend before the provider is called, not dashboards that turn red afterwards.
  • Failover to another provider or model when one is down.
  • Data rules — mask, redact, block — applied to every prompt, including in applications nobody touched.
  • A record of every request: who, which model, why, what it cost, which rules applied.
  • Models added or swapped in configuration, without a deploy of every application.
THE HONEST PART

What it costs you

  • One more service to run. Embedded mode needs nothing external but is single-node and in-memory, for trials; production runs on Postgres and OpenFGA, plus Redis once there are several replicas.
  • One more network hop. A few milliseconds against model calls of hundreds of milliseconds to seconds — and cache hits come back faster than any provider.
  • Someone has to own it. Usually the platform team, the same people who own your other shared infrastructure.
FAQ

Questions that come up

Do I have to change application code?

Two lines per application: the base URL and the key. If your applications read both from the environment, not even that — you change the environment.

Can we move only one application?

Yes. Applications that still call the provider directly keep working. Moving one at a time is the recommended path.

Do streaming and tool calling still work?

Yes. Streaming is true server-sent events, and tool calling, vision and structured output are preserved across OpenAI, Anthropic and Gemini request shapes.

Does our data go to bitkaio?

No. Wäg runs in your infrastructure and talks only to the providers you configure. There is no telemetry and no phone-home, and the licence is a signed offline token with no licence server.

What do we need to run it?

For a first application, one container in embedded mode. For production, Postgres and OpenFGA, plus Redis to keep budgets and rate limits consistent across replicas. A first-party Kubernetes operator or a Helm chart installs it; the databases stay yours.

One endpoint. Every model. Complete control.

Start with the open source

Run it in your own infrastructure

Everything you need to run a control plane in production is Apache-2.0 and stays that way — routing, HA, caching, failover, budgets, policy, MCP, jobs and observability. Self-hosted, no account, no phone-home.

$ docker run -p 4000:4000 <registry>/waeg-gateway:<version>

Not a working pull: the images are not public yet. Design partners receive the registry details privately.

Deploy in 5 minutes
Design partnership

Shape it as a design partner

Wäg is not publicly released yet. We are working with a small cohort of teams running multi-provider AI in production, and serious about governance and sovereignty, to harden the control plane on real workloads.

  • Every Enterprise capability included, at no licence cost
  • Hands-on migration — we do it with you, including from LiteLLM
  • A direct line to the engineers building it, and real influence on what ships next
Apply to the program