Skip to main content

What maps to what

Two Portkey features have no equivalent: strategy.mode: "loadbalance" with weights across targets, and cache.mode: "semantic". The gateway tries providers in order and caches only what the provider caches. The gateway reads no x-portkey-* header. Remove them from the request.

1. Move the credentials

For each Portkey virtual key, add a row under Settings > Model Providers with the same provider key. Rows can belong to the organization, a team or a project.

2. Turn each config into a routing policy

A Portkey config with fallback targets becomes a routing policy that lists the same providers in the same order. Open AI Gateway > Routing policies, create the policy, and pick it under Routing when you create the virtual key.
Model aliases on the policy map a name your code sends to the model each provider serves, for example gpt-5-mini to azure/acme-mini-eu. See Model aliases.

3. Create the virtual keys

One virtual key per application, team or person, with its budget and routing policy. See Virtual keys.

4. Change the client

The Anthropic SDK takes base_url="https://gateway.langwatch.ai" and the virtual key as api_key. See Python and TypeScript.

5. Verify

Send one request and check that the response carries X-LangWatch-Gateway-Request-Id. Open Trace Explorer in the key’s project for the trace, and AI Gateway > Usage for the spend. A response with X-LangWatch-Fallback-Count went through more than one provider.

What the application sees on a breach

A block budget at its limit answers 402 budget_exceeded; a warn budget adds X-LangWatch-Budget-Warning and serves the request. See Budgets and Errors.
Last modified on September 6, 2026