Anthropic Compatible

The standard Anthropic Messages compatible path, suited to the Anthropic SDK and existing Anthropic code migration.

POST/api/v1/messages

Anthropic 兼容

标准 Anthropic Messages 兼容路径;历史路径 /api/anthropic/v1/messages 继续兼容。

Bearer API KeyUse the Authorization: Bearer sk_live_... header; x-api-key is also supported.
Confirm the model call name firstFirst filter models that support this endpoint format on the Models page, then open a model detail page to copy its call name. Your account's final availability also depends on organization permissions.

Request structure

The section below confirms the method, URL and authentication scheme. It is an HTTP structure snippet, not a standalone runnable example.

HTTP
POST https://www.silvamux.com/api/v1/messages
Authorization: Bearer $SILVAMUX_API_KEY
Content-Type: application/json

Request body

application/json · AnthropicRequest · Required

FieldTypeRequiredDescription
max_tokensintegerYes
messagesarray<Message>Yes
messages.contentstring | array<FreeFormObject>Yes
messages.rolestring (system | user | assistant | tool)Yes
modelstringYes
streambooleanNoDefault: false
systemstring | array<FreeFormObject>No

Response

200Anthropic JSON 或 SSE 响应。

application/json · FreeFormObject

defaultAnthropic 兼容错误。

application/json · AnthropicError

FieldTypeRequiredDescription
errorobjectYes
error.messagestringYes
error.typestringYes
typestring (error)Yes
The historical path /api/anthropic/v1/messages remains supported for existing projects only; new projects should use /api/v1/messages.

Examples

curl https://www.silvamux.com/api/v1/messages \
  -H "Authorization: Bearer $SILVAMUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-m2.5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Response (Anthropic format):

{
  "id": "msg_xxxx",
  "type": "message",
  "role": "assistant",
  "content": [{"type": "text", "text": "Hello! How can I help you today?"}],
  "usage": {"input_tokens": 10, "output_tokens": 15}
}

Streaming follows the Anthropic SSE specification.