shreemaan-abhishek opened a new pull request, #13320:
URL: https://github.com/apache/apisix/pull/13320

   ### Description
   
   The `ai-proxy` plugin currently rejects any request whose body does not 
match a known protocol (openai-chat, openai-responses, openai-embeddings, 
anthropic-messages, bedrock-converse), making it impossible to proxy 
OpenAI-compatible APIs whose body shape isn't recognized — for example 
`/v1/images/generations`, whose `{prompt, model, n, size}` body matches no 
existing matcher. This PR adds a `passthrough` protocol adapter that is 
registered last in the detection order and matches any non-empty JSON body, 
acting as a catch-all. When selected, the plugin forwards the request body 
unchanged to the upstream using `ctx.var.uri` (or `override.endpoint` when 
configured) as the target path; only model rewrite (`options.model`), auth 
header injection (`auth.header`), and endpoint override (`override.endpoint`) 
are applied. All other protocol hooks (SSE parsing, usage extraction, message 
manipulation, response text extraction) return safe no-op values, so 
passthrough imposes zero parsing c
 ost and stays out of the way of arbitrary upstream payloads.
   
   #### Which issue(s) this PR fixes:
   Fixes #
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to