SilvaMux Unified Entry

An optional cross-protocol unified entry. It accepts the OpenAI Chat format, picks the upstream automatically based on model, and normalizes responses, SSE, and errors into the OpenAI Chat format. Useful when you want to call models across protocols through a single endpoint.

POST/api/v0/chat/completions

SilvaMux 统一入口

可选的跨协议统一入口。按 model 选择上游,并将响应、SSE 和错误统一为 OpenAI Chat 格式。

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/v0/chat/completions
Authorization: Bearer $SILVAMUX_API_KEY
Content-Type: application/json

Request body

application/json · OpenAIChatRequest · Required

FieldTypeRequiredDescription
max_tokensintegerNo
messagesarray<Message>Yes
messages.contentstring | array<FreeFormObject>Yes
messages.rolestring (system | user | assistant | tool)Yes
modelstringYesSilvaMux 模型 id 或 alias。
streambooleanNoDefault: false
temperaturenumberNo
toolsarray<FreeFormObject>No

Response

200OpenAI Chat JSON 或 SSE 响应。

application/json · OpenAIChatResponse

FieldTypeRequiredDescription
choicesarray<FreeFormObject>Yes
idstringYes
modelstringNo
objectstringNo
usageFreeFormObjectNo

defaultOpenAI 兼容错误。

application/json · OpenAIError

FieldTypeRequiredDescription
errorobjectYes
error.codestring | integerNo
error.messagestringYes
error.typestringNo

Examples

curl https://www.silvamux.com/api/v0/chat/completions \
  -H "Authorization: Bearer $SILVAMUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-m2.5",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
The unified entry normalizes request and response structures. When you need vendor-specific fields, events, or response shapes, prefer the corresponding vendor protocol compatible entry.