Skip to main content
The gateway itself does not require authentication by default when self-hosted. Authentication is handled at the provider level — you pass the target provider’s credentials with each request. For the Portkey hosted service, you additionally need a Portkey API key.

Provider authentication

Pass the provider’s API key using the standard Authorization header, paired with the x-portkey-provider header to tell the gateway which provider to route to.
The value of Authorization is forwarded to the target provider as-is.

Portkey hosted service

When using the Portkey Cloud, pass your Portkey API key using the x-portkey-api-key header instead of managing provider credentials directly. Portkey’s virtual key system handles credential management on the backend.
Virtual keys let you store provider API keys in Portkey’s secure vault and reference them by name. See the Portkey documentation for virtual key setup.

Examples

Config-based authentication

When using the x-portkey-config header, provider credentials can be embedded directly in the config object instead of passed via Authorization.
Avoid embedding API keys directly in request headers or client-side code in production. Use environment variables or Portkey’s virtual key system.

AWS Bedrock authentication

For AWS Bedrock, pass AWS credentials via dedicated headers instead of Authorization: