What changes
The code change is two settings per client: the base URL and the API key. The provider keys move out of your application and into LangWatch, and each application gets a virtual key.1. Add the provider credentials
Open Settings > Model Providers and add a row per provider your application calls, with the same key it uses today. See Providers.2. Create a virtual key
Open AI Gateway > Virtual Keys, click New virtual key, name it after the application, keep Ownership on the project you want the traces in, and set a budget if you want one now. Copy the secret into your secret manager. From the CLI:3. Change the base URL and the key
Prefix the model with the provider:
gpt-5-mini becomes openai/gpt-5-mini. A bare gpt-5-mini, claude-* or gemini-* name still resolves when the key reaches that provider, so this step can wait. See Model naming.
Per SDK and framework: Python, TypeScript.
4. Verify
Send one request and read the response headers.X-LangWatch-Gateway-Request-Id is present on every response that went through the gateway.
5. Add what the code could not do
Each of these is a setting on the key or the project, with no change in application code.6. Remove the provider keys from the application
Once every deployment runs on the virtual key, delete the provider key from the application’s secrets. The gateway keeps using the key stored on the provider row. If you rotate the provider key at the provider, update the row under Settings > Model Providers. Until you do, the gateway sends the old key, and the provider rejects it with401 provider_credential_rejected.
What to expect in error handling
A provider error is forwarded with the provider’s status, and
X-LangWatch-Provider names the provider. When a routing policy tried more than one provider, X-LangWatch-Fallback-Count says how many. See Errors.