Repository navigation
Description
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 AdminAiCommonConfig. WithproxyEnabled=trueit reads headerX-API-KEY(Constants.X_API_KEY) as a ShenYu proxy key and maps it throughAiProxyApiKeyCache. A miss returns 401. Because header names are case-insensitive, Anthropic's nativex-api-keyheader is taken as a ShenYu proxy key and rejected. - Headers.
OpenAi.headers(L143-L152) builds the upstream headers from provider options only:Content-Type,AcceptandcredentialName: credentialPrefix + apiKey. Client headers such asanthropic-version,anthropic-betaandOpenAI-Organizationare 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/completionsand/v1/responsesexist. The client path and query are ignored, so model-in-path APIs such as Gemini/v1beta/models/{model}:streamGenerateContent?alt=ssecannot 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:
- 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 theX-API-KEYproxy-key lookup in this mode. - Forward client request headers, except hop-by-hop headers and
Host. Host is derived from the configured vendor base URL. - Forward the client path, after the selector prefix is stripped, and the query string to the configured vendor base URL.
- Stream the request body without decoding or re-encoding it. Stream the response, including SSE, unchanged.
- 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.
- 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:443withprotocol: https://, ruleretry: 0, andshenyu.httpclient.responseTimeout/readTimeoutraised 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
- Request-side protocol detection is being unified in [Task] Unify AI protocol detection and support ai-prompt for more protocols #8371 / feat(ai): unify AI protocol detection and support ai-prompt for openai-response #8409 (path, then header, then body). Passthrough needs that detector to decide which observing plugins apply.
- Native Anthropic Messages and Gemini support are tracked in [Feature][AI Proxy] Add an opt-in native Anthropic Messages protocol and provider binding #8388 and [Feature][AI Proxy] Add opt-in native Gemini generateContent and streaming support #8389. Their usage and SSE parsers are what passthrough observability would reuse. Gemini
usageMetadatais not parsed anywhere today. - Long SSE streams through the HTTP client are cut by the global 3 s
responseTimeout/readTimeoutdefaults. That is tracked separately. - This changes plugin configuration semantics, so it needs an IssueSpec Proposal and Design before implementation.
Activity
fusenning119 commentedon Nov 12, 2026
/assign