Send requests directly to a custom model without parameter transformation
The Passthrough provider allows you to send requests exactly as they are to any backend provider, without Portkey’s usual parameter mapping or validation.
This is not recommended because you lose out on features like cost attribution and rate limiting,
but useful when you need full control over the request body or when working with provider-specific features that aren’t part of the standard API signatures.
With standard providers like Anthropic or OpenAI, Portkey validates and transforms your request to match the expected API signature. With Passthrough, your request body is forwarded directly to the target endpoint without any modifications.
All headers except those starting with x-portkey- are forwarded to the target endpoint. This includes:
authorization - Your target provider’s API key
Content-Type - Request content type
Any custom headers your endpoint requires
from portkey_ai import Portkeyportkey = Portkey( api_key="PORTKEY_API_KEY", provider="passthrough", custom_host="https://my.vllm.com/v1", default_headers={ "my_custom_header": "abc" })# Request body is sent directly without transformationresponse = portkey.chat.completions.create( model="my-custom-vllm-model", messages=[{"role": "user", "content": "Hello!"}], # Any parameters you include are passed through unchanged stream=True, max_completion_tokens=1000, random_key="value" # Custom parameters supported)print(response.choices[0].message.content)
import Portkey from 'portkey-ai'const portkey = new Portkey({ apiKey: "PORTKEY_API_KEY", provider: "passthrough", customHost: "https://my.vllm.com/v1", defaultHeaders: { "my-custom-header": "abc" }})// Request body is sent directly without transformationconst response = await portkey.chat.completions.create({ model: "my-custom-vllm-model", messages: [{ role: "user", content: "Hello!" }], // Any parameters you include are passed through unchanged stream: true, max_completion_tokens: 1000, random_key: "value" // Custom parameters supported})console.log(response.choices[0].message.content)
When you use the Passthrough provider with any unified route (like /v1/chat/completions or /v1/messages), Portkey:
Receives your request as-is without validating against standard parameter signatures
Forwards the entire request body directly to the configured backend
Returns the response from the provider without transformation
This differs from standard providers where Portkey normalizes parameters, validates required fields, and transforms requests to match each provider’s API format.
// Your request{ "model": "@anthropic/claude-sonnet-4-5-20250929", "messages": [{"role": "user", "content": "Hi"}], "unknown_param": "value" // This may be rejected or ignored}// Portkey validates and transforms before sending to Anthropic
Passthrough provider:
// Your request - with x-portkey-custom-host header set{ "model": "claude-sonnet-4-5-20250929", "messages": [{"role": "user", "content": "Hi"}], "unknown_param": "value" // Passed through unchanged}// Sent directly to the backend exactly as provided