Skip to content

Native provider passthrough

Last updated: 2026-11-23T10:17:09-03:00 (UTC-3)

A passthrough alias exposes an operator-selected native provider action through the gateway. The gateway authenticates the caller and the provider, applies the alias’s access policy, and forwards the request bytes without translating the payload or replacing its model field. Use ordinary inference endpoints when you want protocol translation, prompt policies or a protected financial profile.

The alias has the exclusive passthrough capability and one target. Its target fixes the provider connection and the operator’s upstream model label. The passthrough policy fixes the method and path relative to that provider’s Base URL. The client never supplies another origin, provider credential or forwarding URL.

This fragment defines one native OpenAI Responses action. The model name is an example, not a gateway default; confirm availability in your provider account. Add it to the gateway configuration and provide the referenced secret through the deployment. It is not a complete installation configuration.

features:
provider_passthrough: true
provider_passthrough_usage: true
providers:
- id: openai
protocol: openai
base_url: https://api.openai.com/v1
api_key_env: OPENAI_API_KEY
models:
- id: native-responses
capabilities: [passthrough]
targets:
- provider: openai
model: gpt-5.4-nano
passthrough:
method: POST
upstream_path: /responses
include_subpath: false
usage_profile: openai_responses
allowed_query_params: []

Grant a key route:passthrough and the native-responses alias through the ordinary team/key policy. The body names the upstream model explicitly; native-responses is a gateway permission and route name, not a substituted JSON model.

Terminal window
BASE_URL='http://localhost:8080'
: "${GATEWAY_API_KEY:?set a key authorized for native-responses}"
curl --fail-with-body -sS -X POST "$BASE_URL/v1/passthrough/native-responses" \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary '{"model":"gpt-5.4-nano","input":"Reply with OK","reasoning":{"effort":"none"},"max_output_tokens":16,"store":false}'

Keys of the models[].passthrough block:

Field Default Accepted profile
models[].passthrough.method Required; the editor presets POST only for a new draft One of GET, HEAD, POST, PUT, PATCH, DELETE
models[].passthrough.upstream_path Required Rooted ASCII path, 1–2048 bytes, appended to the configured provider Base URL
models[].passthrough.include_subpath false When enabled, a client suffix can contain at most 2048 bytes and 32 safe segments
models[].passthrough.usage_profile none none, openai_chat, openai_responses, anthropic_messages, gemini_generate_content
models[].passthrough.allowed_query_params [] At most 32 unique case-sensitive names, each at most 64 bytes; credential, identity and hop-control names remain forbidden

The exclusive passthrough alias must be a safe 1–64 character URL segment: letters/digits first, followed by letters, digits, dots, underscores or hyphens. It must have exactly one target. No implicit alias-family, cache, retry or fallback broadens the native action.

Paths cannot contain another authority/URL, query, fragment, dot segment or ambiguous encoded slash/backslash. The request query is limited to 8192 bytes, each value to 1024; duplicate names and unlisted names are rejected. Allow only query parameters your selected endpoint actually needs. Enabling a suffix grants the configured subtree, while retaining the same host and prefix.

The execution flag provider_passthrough and the separate usage flag provider_passthrough_usage default to false. Usage depends on execution. If a non-none profile is configured while its usage flag is off, the action refuses rather than silently disabling the configured observation. Use none explicitly when no measurement is wanted.

OpenAI profiles require an OpenAI-protocol connection, Anthropic Messages requires Anthropic, and GenerateContent requires Gemini. JSON observation uses the existing 64 KiB capture bound; an answer beyond the measurement profile may be relayed with unknown usage. SSE measurement additionally requires stream_usage and its bounded supported event profile. Binary vendor event streams are relayed as bytes, with no invented token decoder.

Calling an alias requires route:passthrough (or the reviewed route:* scope), permission for that alias in the key and team policy, and the applicable feature and plan rights. Existing source-IP, attribution, rate and concurrency controls apply. A route or feature flag grants no permission by itself.

An alias grants the configured native action and its accepted body. It does not rewrite or independently authorize every resource ID or model name nested in that opaque body. Grant narrowly scoped endpoints to the teams and keys that need them. Do not expose an entire account’s management API through a broad path unless that is the intended permission.

With organization admins on, every organization shares the provider account, so an action whose usage profile is openai_chat, openai_responses, anthropic_messages or gemini_generate_content refuses, with 422 provider_state_not_isolated and before sending, any subpath (it addresses a stored object by the provider’s own ID), a body naming stored state (previous_response_id, conversation, an item reference, a reasoning item by ID, a provider file the request reads, a Messages container or container_upload, a Gemini cachedContent or fileData.fileUri) and a body the gateway cannot read, such as a compressed one. Use the gateway’s own /v1/responses and /v1/messages routes for stored state. Actions with no usage profile stay opaque: only what the alias grants limits them.

The body is not parsed and reserialized for forwarding. This preserves multipart boundaries, binary content and native request formats. The configured provider supplies authentication; the client’s gateway bearer and protected identity headers never become upstream provider credentials. Per-provider CA, mTLS and proxy settings use the same captured transport generation as ordinary inference.

Requests and responses retain the existing body/admission/stream limits and cancellation ownership. Upstream redirects are refused. There is no retry, fallback or response cache: a timeout or broken stream must not replay a potentially stateful operation. Configuration changes affect newly admitted operations, while an admitted response retains its selected connection.

Optional subpaths and query names must be explicitly allowed in the alias policy. They do not allow a different host or escape the configured path prefix. Invalid or ambiguous paths, credential-bearing query parameters and unlisted query names are refused before sending. Configure a separate alias for an action requiring a different method or destination.

Optional usage collection uses an explicitly selected existing native response profile. It observes reported token counts without altering the response, and it does not infer support or cost from an arbitrary endpoint name. Missing, unsupported or incomplete usage remains unknown; it is never treated as zero.

Usage observation does not qualify an opaque operation for a budget or TPM reservation. If an applicable policy requires a financial/token profile that this action cannot prove, the gateway refuses before contacting the provider. This includes applicable global and provider policies, in addition to key, team, user, organization, project and model policies. Disabling usage collection cannot bypass a limit.

Likewise, an opaque endpoint cannot silently bypass an applicable prompt, guardrail or request transformation that it cannot implement. Use a supported ordinary inference profile when those controls are required.

The request retains its request/correlation ID and W3C trace context through the provider call. Request metadata, native usage and failures use the ordinary log/telemetry flow. Payloads, provider credentials and proxy authentication are not telemetry. A refusal before dispatch never becomes an upstream attempt or a charge. Authenticated proxy errors retain the existing privacy boundary described in provider network policy.

The same versioned YAML, administrative API and native console manage this policy. YAML remains the base; a validated versioned console/API override takes precedence, and reverting restores the YAML alias. Current write permissions, optimistic version checks, license guards and audit apply to every mutation.

Upgrade older writers/readers before persisting a new policy field. A network or credential failure keeps its normal failure classification; repair the selected provider rather than broadening the route or enabling an unprotected alternative. Route availability is configuration, not a claim that the upstream supports an operation or that a health check passed.

m7gtwcontact@m7gtw.com