Skip to main content
Add multiple provider keys to the same routing rule in an access key configuration. The gateway tries keys in order when one fails. Your application sends only an access key—provider keys are stored in app.ngrok.ai and referenced by the configuration.

Setup

  1. Add two or more provider keys for the same provider
  2. Create or edit a configuration with an ordered user step listing both key IDs
  3. Assign the configuration to your access key
{
  "router": {
    "rules": [
      {
        "provider": "openai",
        "steps": [
          {
            "type": "user",
            "keySelectionStrategy": "ordered",
            "keys": [
              { "id": "aigpk_primary" },
              { "id": "aigpk_backup" }
            ]
          }
        ]
      }
    ]
  }
}

Failover sequence

1. Request arrives with access key
2. Try primary OpenAI key → Rate limited (429)
3. Try backup OpenAI key → Success

Next steps