Before you start
This migration applies to you if your Traffic Policy hasapi_keys under one or more providers:
Migration steps
Create an AI Gateway Managed Key
First, create an AI Gateway Managed Key that will be added to your SDK or cURL requests.Make sure to save the
ng-xxxxx-g1-xxxxx token since this will be the only time you’ll see the unredacted key.Attach your keys to your AI Gateway API Key
For each provider and key in your Traffic Policy, attach the key to your AI Gateway API Key.The most recently attached key is tried first. Attach the key you want tried first last.
Verify the attached keys work
Before removing keys from Traffic Policy, confirm your attached keys are routing correctly. Make a test request using your AI Gateway API Key and check the response:Check your AI gateway’s usage page to confirm the request used your attached key. If the attached key works, you’re safe to remove the BYOK config in the next step.
Remove api_keys from your Traffic Policy
Remove the After:Deploy the updated Traffic Policy.
api_keys fields from your provider configurations. If a provider has no other configuration (models, base_url, metadata), you can remove it entirely.Before:Confirm requests still work
Make another test request and verify it succeeds. The gateway now routes using your attached provider keys.If requests fail, check error codes and verify your keys were attached correctly:
What doesn’t change
- Your application code: same AI Gateway API Key, same gateway URL, no client changes needed
- Failover behavior: attached keys are tried in reverse order of attachment (most recently attached first)
- Gateway auth: the gateway still validates requests with your AI Gateway API Key before routing
- Observability: you can inspect which key was used on your AI Gateway’s usage page
What changes
| Traffic Policy BYOK | Attached provider keys | |
|---|---|---|
| Key rotation | Update secret or Traffic Policy, redeploy | Add new key, remove old key via API—no redeploy |
| CEL selection | Supported | Not supported (simple failover only) |
Custom providers (base_url) | Supported | Not supported—keep in Traffic Policy |
| Secrets vault needed | Yes | No |
| Key visible in config | As secret reference | Never visible |
Next steps
- Attaching Provider Keys: full reference for managing attached keys
- Managing Provider Keys (BYOK): if you’re staying with Traffic Policy keys for custom providers