Skip to content

[Feature][AI Proxy] Add an opt-in vendor-native passthrough mode #8454

Open

Description

@Aias00

Feature Request

Add an opt-in vendor-native passthrough mode to the AI proxy plugin. In this mode the client calls a model vendor with its own credentials and native protocol, only replacing the vendor base URL with the gateway URL. The gateway forwards the request and response unchanged, while still applying the AI features that can read the native format.

This matches the "protocol passthrough" access method that commercial AI gateways offer next to OpenAI-compatible access, for example the Volcengine AI accelerated gateway.

Is your feature request related to a problem? Please describe

Today a native passthrough is only possible through the divide plugin as a generic HTTP proxy. That loses all AI awareness. The ai-proxy plugin cannot be used for passthrough, because it always replaces the client's credentials, headers, path and body (master @ 9dd9a12):

  • Credentials. AiProxyPlugin.executeRequest (L135-L174) uses the API key from the Admin AiCommonConfig. With proxyEnabled=true it reads header X-API-KEY (Constants.X_API_KEY) as a ShenYu proxy key and maps it through AiProxyApiKeyCache. A miss returns 401. Because header names are case-insensitive, Anthropic's native x-api-key header is taken as a ShenYu proxy key and rejected.
  • Headers. OpenAi.headers (L143-L152) builds the upstream headers from provider options only: Content-Type, Accept and credentialName: credentialPrefix + apiKey. Client headers such as anthropic-version, anthropic-beta and OpenAI-Organization are dropped.
  • Body. The request body is joined up to 5 MB and re-prepared by OpenAi.prepare (L120-L141), which applies model mapping and the protocol binding transform.
  • Path and query. The upstream endpoint is fixed per binding (resolveEndpoint(config, binding.path()), L136). Only /v1/chat/completions and /v1/responses exist. The client path and query are ignored, so model-in-path APIs such as Gemini /v1beta/models/{model}:streamGenerateContent?alt=sse cannot be expressed.

Describe the solution you'd like

An explicit, opt-in passthrough mode on the ai-proxy selector handle, for example "mode": "passthrough", off by default so existing behavior is unchanged:

  1. Forward the client's credential headers or query parameters (Authorization, x-api-key, x-goog-api-key, ?key=) unchanged, and do not use a configured key or the X-API-KEY proxy-key lookup in this mode.
  2. Forward client request headers, except hop-by-hop headers and Host. Host is derived from the configured vendor base URL.
  3. Forward the client path, after the selector prefix is stripped, and the query string to the configured vendor base URL.
  4. Stream the request body without decoding or re-encoding it. Stream the response, including SSE, unchanged.
  5. Let AI plugins that only observe the traffic keep working when they understand the native protocol: usage metering, token limiting, observability. Plugins that must rewrite the body (prompt, request transformer, fallback to another provider, response cache) are skipped or rejected at configuration time in this mode.
  6. Document which features apply in passthrough and which require the converted mode.

Describe alternatives you've considered

  • divide plugin as a plain HTTP proxy. This works today with configuration only: an upstream such as api.openai.com:443 with protocol: https://, rule retry: 0, and shenyu.httpclient.responseTimeout / readTimeout raised or disabled. But it gives no AI usage accounting, token limits or AI observability.
  • Converting every vendor to OpenAI format in ai-proxy. This loses vendor-specific request and response fields, and is what passthrough users want to avoid.

Additional context

Activity

  1. fusenning119 commented on Nov 12, 2026

    @fusenning119
    Contributor

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions