uniprewan opened a new pull request, #12936:
URL: https://github.com/apache/apisix/pull/12936

   ### Description
   
   This PR introduces **native Anthropic API support** to the `ai-proxy` plugin.
   
   Instead of relying on the OpenAI-compatible adapter, this implementation
   adds first-class support for Anthropic’s **native `/v1/messages` endpoint**
   and protocol, including request/response translation and streaming semantics.
   
   Anthropic’s API is not fully compatible with OpenAI’s Chat Completions API:
   it differs in endpoint shape, authentication headers, request/response 
schema,
   and streaming behavior. Native support is required to ensure correctness,
   extensibility, and long-term maintainability.
   
   ---
   
   #### Which issue(s) this PR fixes:
   
   This PR does not directly close an existing issue.
   
   It addresses the gap in native Anthropic support discussed in previous 
reviews
   and supersedes the earlier attempt in #12924, which was closed after branch
   recreation during refactoring and test stabilization.
   
   ---
   
   ### Changes introduced in this PR
   
   - Add a native Anthropic driver for `ai-proxy`
   - Support Anthropic `/v1/messages` endpoint
   - Proper authentication via `x-api-key`
   - Automatic injection of required `anthropic-version` header
   - Request and response translation aligned with Anthropic’s API contract
   - Support for Anthropic streaming (SSE)
   - Independent driver implementation to avoid OpenAI-specific assumptions
   - Add documentation for Anthropic native usage
   - Add contract tests covering request handling, response parsing, and 
streaming
   
   ---
   
   ### Backward compatibility
   
   This change is **fully backward compatible**.
   
   Existing OpenAI-compatible configurations remain unchanged.
   The native Anthropic driver is only enabled when the `anthropic`
   provider is explicitly configured.
   
   ---
   
   ### 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
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible


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