1. Messages
Sionic Opengateway
  • Default module
    • Overview
      • Getting Started With OpenGateway
      • Model Compatible
    • Apis
      • /chat/completions
      • /v1/chat/completions
  • og-onprem
    • Chat Completions
      • Create chat completion
    • Responses
      • Create a model response
    • Messages
      • Create a message (Anthropic Messages format)
        POST
    • Embeddings
      • Create embeddings
    • Images
      • Create image
      • Edit image
    • Models
      • List models
    • Schemas
      • ModelId
      • DebugCategory
      • FallbackModels
      • DebugCategories
      • Extra
      • Debug
      • OpenAIError
      • OpenAIErrorResponse
      • AnthropicErrorResponse
      • CacheControl
      • ChatContentPart
      • ChatTextPart
      • ChatImagePart
      • ToolCall
      • ChatMessage
      • FunctionDefinition
      • ChatTool
      • ToolChoice
      • ChatCompletionRequest
      • ChatCompletionUsage
      • LogprobToken
      • ChatCompletion
      • ChatCompletionChunk
      • ResponsesInputItem
      • ResponsesMessageItem
      • ResponsesFunctionCallItem
      • ResponsesFunctionCallOutputItem
      • ResponsesTool
      • ResponsesRequest
      • ResponseObject
      • MessagesRequest
      • AnthropicMessage
      • EmbeddingsRequest
      • EmbeddingsResponse
      • ImageGenerationRequest
      • ImageEditRequest
      • ImagesResponse
      • ModelStatus
      • CatalogEndpoint
      • Model
      • ModelList
  1. Messages

Create a message (Anthropic Messages format)

POST
/messages
Accepts the Anthropic Messages request format and routes only to models that list messages
in their catalog endpoints. The data plane requires a JSON object and a non-empty model;
the provider validates the rest of the body. extra.fallbacks is consumed and extra is
removed before forwarding. The response id is rewritten to the gateway request ID and
model to the public catalog model ID.
Authentication: Authorization: Bearer <key> (default). x-api-key is accepted only when no
Authorization header is sent; an empty or invalid Bearer value returns 401 and does not
fall back to x-api-key.
With stream: true the response is the Anthropic SSE event stream (message_start,
content_block_start, content_block_delta, content_block_stop, message_delta,
message_stop); tool input may arrive in input_json_delta pieces. This endpoint does not
return the OpenGateway debug object. Errors use the Anthropic error envelope.

Request

Header Params

Body Params application/jsonRequired

Example
{
    "model": "deepseek/deepseek-v4.1-flash-ultrafast",
    "max_tokens": 256,
    "messages": [
        {
            "role": "user",
            "content": "Hello"
        }
    ]
}

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location '/messages' \
--header 'anthropic-version;' \
--header 'anthropic-beta;' \
--header 'x-opengateway-user-id;' \
--header 'x-opengateway-session-id;' \
--header 'x-sionic-task-id;' \
--header 'Content-Type: application/json' \
--data '{
    "model": "deepseek/deepseek-v4.1-flash-ultrafast",
    "max_tokens": 256,
    "messages": [
        {
            "role": "user",
            "content": "Hello"
        }
    ]
}'

Responses

🟢200OK
application/json
An Anthropic Message object, or the Anthropic SSE event stream when stream is true.
Body

Example
{
    "id": "msg_example",
    "type": "message",
    "role": "assistant",
    "model": "deepseek/deepseek-v4.1-flash-ultrafast",
    "content": [
        {
            "type": "text",
            "text": "Hello!"
        }
    ],
    "stop_reason": "end_turn",
    "stop_sequence": null,
    "usage": {
        "input_tokens": 12,
        "output_tokens": 4
    }
}
🟠400Bad Request
🟠401Unauthorized
🟠402
🟠403Forbidden
🟠404Record Not Found
🟠429
🔴500Server Error
🔴503Service Unavailable
🔴504Gateway Timeout
🔴529
Modified at 2026-10-27 15:03:30
Previous
Create a model response
Next
Create embeddings
Built with