Skip to main content
The AI Gateway uses the OpenAI API format. Migrating an existing application means changing three values: the base URL, the API key, and the model name. Request bodies, response bodies, and streaming stay the same. Tool calling is unchanged for most models, with one exception noted below.

What changes

The base URL does not vary by region or by workspace. Data stored in the Orq.ai platform resides in the European Union, while the region a model is served from depends on the model and is filterable on the Models page. See Sovereign AI. A private model carries its workspace in the model name as <workspace>@<provider>/<model> rather than in the URL. See Private Models.

What works immediately

Once those three values are in place, the following need no further code:
  • Cost per call: every request records input, output, and total cost.
  • Traces: every request is recorded with its latency, token counts, and the model that answered.
  • Model access: every model enabled on the Models page is reachable from the same client, whichever provider serves it. Browse the catalog in Supported Models.
  • Routing Rules: route or restrict traffic from the AI Gateway interface, without touching the application. See Routing Rules.
Fallbacks, Retries, Cache, and Guardrails are opt-in fields on the request body, covered in What Orq.ai adds.

What does not carry over

Two areas do not transfer.

Before starting

Complete the Quick Start first. A migration needs an API key, and every model the application calls has to be enabled on the Models page, not just the one used for the first request. Access to those models comes from Credits or BYOK. Export the key before starting. The steps below read it, and so does the coding agent when it checks model names against the catalog.

Migrate with a coding agent

Paste the prompt below into a coding agent such as Claude Code, Cursor, or Codex. The agent finds the LLM calls in the repository and rewrites them. The prompt does the following:
  1. Points every LLM client at https://api.orq.ai/v3/router.
  2. Replaces the old API key variable with ORQ_API_KEY, in code and in environment files.
  3. Rewrites model names to the provider/model format.
  4. Converts routing settings from the previous gateway instead of deleting them.
  5. Checks every model name against the catalog, and leaves a call site untouched rather than substituting a model or half-migrating it.
  6. Leaves request and response handling untouched.
Start from a clean git working tree, so every change is visible in git diff and revertible with git checkout .. Review the diff before running the application. Migrating by hand instead? Skip to Migrate from the OpenAI SDK.
Migration prompt
Model names are not guaranteed to match between gateways. Check every name the agent reports against Supported Models before running the application in production. A 404 means either the name is wrong or the model is not enabled on the Models page. fallbacks does not cover this case, because the model is resolved before routing runs.

Migrate from the OpenAI SDK

Change the base URL and the API key. Add the provider prefix to the model name. Both /chat/completions and /responses are available, so keep whichever the application already uses. Before
After
Models from every other provider now work through the same client. See Supported Models.

Migrate from OpenRouter

OpenRouter and the AI Gateway both use the provider/model naming format, so most model names stay the same. The catalogs differ, so confirm every name against GET /models or the Models page before switching. Before
After

Move OpenRouter settings across

Most old OpenRouter fields are ignored rather than rejected, so a partial migration does not fail. The routing they configured no longer applies. Move each one deliberately. plugins is the exception. Both gateways use that field name, and the AI Gateway reads it. A leftover OpenRouter plugins array fails the whole call with a generic Invalid request body that does not name the field. The remaining provider sub-options have no per-request equivalent: require_parameters, quantizations, enforce_distillable_text, preferred_min_throughput, preferred_max_latency, and max_price. Applications that depend on any of these need their routing decided ahead of the request, by selecting models explicitly or through Routing Rules.

Migrate from LiteLLM

LiteLLM Proxy is a server run inside the organization’s own infrastructure. Applications call it instead of calling providers directly, and it forwards each request to the real provider. It exposes an OpenAI-compatible endpoint, on port 4000 by default. There are two ways to move off it. Pick one before making any change. The rest of this section covers the first option.

Find the real model name

LiteLLM Proxy does not use provider model names. It uses nicknames defined in its config.yaml. Each entry pairs the nickname the application calls with the real model behind it:
config.yaml
The application above sends fast-model. The AI Gateway has no such name, so replace it with the real model, openai/gpt-5.6-sol. Open config.yaml and read the litellm_params.model value for every nickname the application uses.
A nickname can look exactly like a real model name. model_name: gpt-4o can point at litellm_params.model: azure/gpt-4o-eu, which is a different model on a different provider. Read litellm_params.model for every entry, including the ones that already look correct.

Change the client

Before, pointing at the proxy and calling it by its nickname:
After, pointing at the AI Gateway and calling the real model:
Routing behavior set in config.yaml, such as fallbacks and retries, moves to the request body. See What Orq.ai adds. To keep LiteLLM as the caller and send its traces to Orq.ai instead, see LiteLLM observability.

Verify the migration

1

Send one request

A 200 response confirms that the base URL, the API key, and the model name are correct.For an application that uses chat completions, replace /responses with /chat/completions and send messages instead of input.
2

Check the trace

Open Traces in the AI Gateway and open the newest request. Confirm all four:If no request appears at all, the application is still calling the old endpoint. Search the repository for the previous base URL and the previous key variable.
3

Move the remaining traffic

Repeat for every service that calls an LLM. Filter Traces by model to confirm that every model the application uses now appears, and to find traffic that has not moved yet.

What Orq.ai adds

Once traffic is flowing, these optional fields go on the same request body. Set in the Orq.ai interface rather than the request body: Budgets for spend limits and alerts, Private Models for self-hosted or fine-tuned models, and Sovereign AI for data residency and zero-retention providers. Adding a fallback and a cache to an existing call:

Next steps

Fallbacks & Retries

Keep requests flowing when a provider fails.

Supported Models

Browse the model catalog and provider capabilities.

OpenAI-Compatible API

Review the full list of compatible endpoints.

Traces

Inspect cost, latency, and token usage per request.