Nitro mode is currently in beta. Behavior may change based on feedback. Contact the Portkey account team to get access.
x-portkey-nitro-mode header. When enabled, the gateway forwards your request body directly to the upstream provider without reading or transforming it. This is useful when your request and response structure already matches the provider’s expected format and you don’t need the gateway to modify the payload.
How It Works
By default, the gateway reads the request body to power features like transformations, retries, fallbacks, guardrails, and other body-based configurations. With Nitro mode enabled, the gateway skips reading the request body entirely and streams it straight to the provider. Since the body is never parsed, features that depend on inspecting or modifying the payload are not available in this mode. See Limitations for details.When to Use Nitro Mode
Nitro mode is a good fit when:- Your request and response structure already matches the provider’s API and you don’t need the gateway to transform the payload. This removes redundant request parsing, which is particularly beneficial for large payloads.
- You are routing to a single provider and don’t need body-based gateway features like fallbacks, retries, or input guardrails.
Example
Add the header to your request:| Header | Value |
|---|---|
x-portkey-nitro-mode | true |
Supported Endpoints
Nitro mode works only on the following endpoints:| Endpoint | Description | Currently Supported Providers |
|---|---|---|
/v1/chat/completions | Chat completions | OpenAI, Fireworks, OpenRouter |
/v1/embeddings | Embeddings | OpenAI, Fireworks, OpenRouter |
/v1/messages | Messages API | Anthropic |
/v1/responses | Responses API | OpenAI, OpenRouter |
Limitations
Since the gateway does not read the request body in Nitro mode, there are a few constraints on how you configure your request.Specifying the Provider
Because the body is never read, the provider must be specified through headers, not in the request body. There are two supported ways: Option 1:x-portkey-provider header
Pass the provider slug directly as a header.
x-portkey-config header
Pass a config that contains a single provider at the top level.
Config Constraints
The following constraints apply when usingx-portkey-config. If violated, the gateway returns an error (except for caching, which is silently ignored).
Single target only
Single target only
The config must route to exactly one provider. Strategies like
loadbalance, fallback, or conditional with multiple targets are not supported.No retries
No retries
Retries require re-reading the request body. Set
retry.attempts to 0 or omit retry entirely.No body-dependent hooks
No body-dependent hooks
Hooks that inspect the request body (such as
input_guardrails or before_request_hooks) are not supported. This also applies to default input guardrails set at the workspace or organisation level.No override_params
No override_params
Since the body is not read,
override_params that change request body fields (such as model or temperature) have no effect and are not supported.Caching is ignored
Caching is ignored
Caching requires reading the full request body to build cache keys. If your config includes
cache, it will be silently ignored. No error is thrown, but the cache will not be used.Errors
If your configuration violates any of the constraints above (except caching, which is silently ignored), the gateway returns an HTTP 4xx error describing the issue. Fix the configuration as indicated in the error message, or remove thex-portkey-nitro-mode header to use standard gateway behavior.
