Skip to content

Messages (Anthropic)

POST /v1/messages

Accepts requests in the Anthropic Messages API format and translates them to the internal OpenAI-compatible format. This allows clients using the Anthropic SDK to use ai& without code changes.

from anthropic import Anthropic
client = Anthropic(
api_key="sk-your-api-key",
base_url="https://api.aiand.com/v1",
)
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)
  • The request body is translated from Anthropic format to OpenAI format internally
  • The response is translated back to Anthropic format before returning
  • Streaming is supported
  • Authentication uses the same Authorization: Bearer header as other endpoints

Standard Anthropic Messages API parameters are supported. Parameters that have no equivalent in the underlying model are silently ignored.