GeorgelPreput opened a new issue, #13566:
URL: https://github.com/apache/apisix/issues/13566

   ### Description
   
   ai-proxy/ai-proxy-multi can translate Anthropic-format clients → 
OpenAI-compatible upstreams (via the anthropic-messages-to-openai-chat 
converter), but not the reverse. There is currently no way to accept OpenAI 
Chat Completions requests and forward them to an upstream that only speaks the 
native Anthropic Messages API (/v1/messages).
   
   I'm trying to proxy an Open WebUI message to Claude on Azure AI Foundry, 
whose [API 
surface](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/claude-models#api-surface)
 is exclusively the native Anthropic Messages API 
(https://<resource>.services.ai.azure.com/anthropic/v1/messages), exposing no 
OpenAI-compatible /chat/completions endpoint.
   
   The APISIX anthropic provider's openai-chat capability assumes the upstream 
offers Anthropic's own OpenAI-compatible endpoint 
(api.anthropic.com/v1/chat/completions). When pointed at a Messages-only 
upstream via override.endpoint, the OpenAI body is passed through unchanged and 
rejected by the upstream.
   
   ### Steps to reproduce
   Route with ai-proxy-multi, provider: anthropic, and override.endpoint set to 
an Azure Foundry Claude deployment (.../anthropic/v1/messages). Send a standard 
OpenAI Chat Completions request:
   ```
   curl "$GATEWAY/v1/chat/completions" -X POST \
     -H "Content-Type: application/json" \
     -d '{
       "model": "claude-opus-4-5",
       "messages": [
         { "role": "system", "content": "You are a mathematician" },
         { "role": "user", "content": "What is 1+1?" }
       ]
     }'
   ```
   
   Actual behavior
   The request is forwarded to the Messages API verbatim (still OpenAI-shaped), 
and the upstream rejects it:
   
   
   {"type":"error","error":{"type":"invalid_request_error",
    "message":"messages.0: use the top-level 'system' parameter for the initial 
system prompt"}}
   The OpenAI convention of a system role inside messages[] is incompatible 
with the Messages API, which requires a top-level system parameter (among other 
format differences: max_tokens required, content blocks, 
input_tokens/output_tokens usage fields, etc.).
   
   Expected behavior
   ai-proxy/ai-proxy-multi should be able to accept an OpenAI Chat Completions 
request from the client and deliver it to a native Anthropic Messages API 
upstream in the correct format (request and response, streaming and 
non-streaming), so that OpenAI-format clients can transparently use 
Anthropic-only backends such as Azure AI Foundry.
   
   Environment
   APISIX version: v3 (Helm chart 2.14.1)
   Plugin: ai-proxy-multi (also applies to ai-proxy), provider: anthropic


-- 
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