Skip to content

[api] bring back anthropic /v1/messages endpoint in OpenAI server#1595

Merged
AlpinDale merged 1 commit into
mainfrom
re-anthropic
Nov 4, 2025
Merged

[api] bring back anthropic /v1/messages endpoint in OpenAI server#1595
AlpinDale merged 1 commit into
mainfrom
re-anthropic

Conversation

@AlpinDale

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: AlpinDale <alpindale@gmail.com>
@AlpinDale AlpinDale merged commit cd631de into main Nov 4, 2025
1 check passed
@AlpinDale AlpinDale deleted the re-anthropic branch November 4, 2025 10:58

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Anthropic /v1/messages endpoint by merging it into the main OpenAI API server, which is a positive step towards code consolidation. The new implementation of the endpoint within aphrodite/endpoints/openai/api_server.py is an improvement, featuring more robust error handling. However, a critical issue has been introduced with duplicated protocol definitions for Anthropic models. This needs to be addressed to prevent future maintenance challenges and confusion.

Comment on lines +42 to +48
from aphrodite.endpoints.anthropic.protocol import (
AnthropicError,
AnthropicErrorResponse,
AnthropicMessagesRequest,
AnthropicMessagesResponse,
)
from aphrodite.endpoints.anthropic.serving_messages import AnthropicServingMessages

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

There is a significant duplication of protocol definitions. This file now imports Anthropic protocol definitions from aphrodite/endpoints/anthropic/protocol.py. However, it appears that similar, but slightly different, definitions have also been added to aphrodite/endpoints/openai/protocol.py.

This duplication can lead to maintenance issues and confusion. For example, AnthropicErrorResponse is defined in aphrodite/endpoints/anthropic/protocol.py and used in this file, but it's missing from the new definitions in aphrodite/endpoints/openai/protocol.py.

To resolve this, all Anthropic-related protocol definitions should be consolidated into a single, authoritative location. Given that the Anthropic endpoint is being moved into the OpenAI server, it would be logical to move all related definitions to aphrodite/endpoints/openai/protocol.py, ensuring they are complete and correct, and then remove aphrodite/endpoints/anthropic/protocol.py. An alternative is to keep the definitions in aphrodite/endpoints/anthropic/protocol.py and remove the duplicated code from aphrodite/endpoints/openai/protocol.py.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant