Docs
Get an API key
API reference›Messages

Create Message

Create a Message using the Anthropic Messages API format. This endpoint accepts Anthropic-native request payloads and returns Anthropic-native responses. The request is adapted internally to the underlying chat completions engine.

System prompt: Use the top-level system parameter for initial instructions. A later text-only system message may follow a user message; it may be last or precede an assistant message.

Content blocks: Message content may be a string or an array of typed content blocks (text, image, tool_use, tool_result).

Assistant prefill: If the final message uses the assistant role, the response continues immediately from that content.

Streaming: Set stream: true to receive server-sent events with typed event names (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop).

Extended thinking: thinking.type: enabled requires budget_tokens below max_tokens and a model that supports enforced thinking budgets; other models reject this mode. Check reasoning.supports_max_tokens in /v1/models?format=openrouter (in the default list, a max_tokens property under the text output's reasoning parameter). adaptive uses the model's own thinking behavior, and disabled turns thinking off. Thinking blocks use API-generated signatures, and display: omitted hides their text while preserving a signature for continuation.

System instructions: A later system message keeps its position when forwarded to the model. Turn-scoped clear_at and per-message output_config are not supported.

Effort: Top-level output_config.effort maps through the selected model's reasoning_config. The :express model variant derives a thinking budget when the selected model supports enforced budgets and no budget is supplied.

Tools: Tools use input_schema (JSON Schema) rather than parameters. Tool results are sent as tool_result content blocks in subsequent user messages.

Errors: Errors use Anthropic's body, {"type": "error", "error": {"type", "message"}}. A request the gateway refuses is a 400 invalid_request_error; Anthropic has no 422. An unknown model is a 404 not_found_error, a rate-limited request a 429 rate_limit_error with Retry-After, a bad or missing key a 401 authentication_error, and a failure on our side or the engine's a 5xx api_error.

Request payload for the Anthropic Messages API format. The request is adapted internally to the underlying chat completions engine.

  • model string required

    The model identifier to use for generation.

  • max_tokens integer required

    Total completion token allowance, including thinking and visible output. The gateway forwards zero if supplied; whether zero is accepted depends on the upstream engine.

    at least 0
  • messages array of objects required

    Input messages. Models operate on alternating user and assistant conversational turns. Consecutive user or assistant turns are combined into a single turn.

    If the final message uses the assistant role, the response content continues immediately from that message's content (assistant prefill).

    A text-only system message may follow a user turn, as the final message or before an assistant turn. Use the top-level system parameter for initial instructions. Turn-scoped clear_at and per-message output_config are not supported.

    at least 1 items
    3 fields
    • role string required

      The role of the message author. A system message must follow user; initial system instructions belong in the top-level system field.

      userassistantsystem
    • content string or array of objects required

      System messages support text blocks only.

      One of 2
      • string

        Shorthand for a single text block.

      • array of objects

        An array of typed content blocks.

    • clear_at string

      Turn-scoped system messages are not supported.

      never
  • system string or array of objects

    System prompt providing context or instructions to the model. May be a string or an array of text blocks.

    One of 2
    • string
    • array of objects
  • stream boolean

    Whether to stream the response using server-sent events. Streaming events use typed event names: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop.

  • temperature number (float)

    Controls randomness in the model responses. Valid range: 0 to 1.

    range 0–1
  • top_p number (float)

    Enables nucleus sampling with a cumulative probability cutoff.

    range 0–1
  • top_k integer

    Limits sampling to the top K options.

  • stop_sequences array of strings

    Custom sequences that, when encountered in the generated text, cause the model to stop.

  • metadata object

    Additional metadata about the request.

    1 field
    • user_id string

      An opaque identifier for the end-user making the request.

  • output_config object

    Output controls. Effort is translated through the selected model's reasoning configuration. Unsupported configured levels return 400.

    1 field
    • effort string
      minimallowmediumhighxhighmaxultra
  • thinking object

    Thinking configuration. The adapter signs its own thinking blocks for continuation; it does not emit redacted thinking blocks.

    3 fields
    • type string

      enabled requests thinking with an exact budget on models that support enforced thinking budgets; adaptive leaves the thinking allocation to the model; disabled turns thinking off.

      enabledadaptivedisabled
    • budget_tokens integer

      Required for enabled; must be less than max_tokens and the effective output limit after context clipping. Models that cannot enforce the budget reject the request.

      at least 1024
    • display string

      omitted hides thinking text while preserving an API-generated signature for continuation. It is invalid when thinking is disabled.

      summarizedomitted
  • tools array of objects

    Definitions for tools available to the model.

    5 fields
    • name string required

      The name of the tool.

      range 1–200 characters
    • description string

      A detailed description of what the tool does.

    • input_schema object required

      A JSON Schema object describing the expected input format for the tool.

    • type string

      Accepted but ignored by the adapter. Tools are forwarded as ordinary function tools using name and input_schema; Anthropic built-in tool behavior is not implemented.

    • cache_control object

      Accepted for Anthropic client compatibility but ignored by the adapter; it does not create a cache breakpoint.

      1 field
      • type string

        The cache control type.

        ephemeral
  • tool_choice object

    Instructs how the model should use any provided tools.

    2 fields
    • type string

      How the model should use tools. auto lets the model decide. any forces at least one tool call. tool forces a specific tool.

      autoanytool
    • name string

      The name of the specific tool to use. Required when type is tool.

OK

application/json, text/event-stream · anthropic-message-response-payload

8 fields
  • id string

    A unique identifier for the response message.

  • type string

    The object type. Always message.

    message
  • role string

    The role of the response. Always assistant.

    assistant
  • model string

    The model that generated the response.

  • content array of objects

    The generated content blocks from the model.

    7 fields
    • type string

      The type of content block.

      textthinkingtool_use
    • text string

      The generated text. Present when type is text.

    • thinking string

      The thinking text. Present when type is thinking.

    • signature string

      The signature for the thinking block. Present when type is thinking.

    • id string

      The unique ID of the tool use. Present when type is tool_use.

    • name string

      The name of the tool called. Present when type is tool_use.

    • input object

      The input parameters for the tool call. Present when type is tool_use.

  • stop_reason string

    The reason the model stopped generating.

    end_turnmax_tokensstop_sequencetool_use
  • stop_sequence string or null

    The specific stop sequence that caused generation to stop, if applicable.

  • usage object

    Token usage information for the request.

    4 fields
    • input_tokens integer

      The number of input tokens processed.

    • output_tokens integer

      The number of output tokens generated.

    • cache_creation_input_tokens integer or null

      The number of tokens used to create a cache entry.

    • cache_read_input_tokens integer or null

      The number of tokens read from the cache.

curl https://api.vultrinference.com/v1/messages \
  -H "Authorization: Bearer $VULTR_INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "max_tokens": 1024,
    "system": "Answer in one sentence.",
    "messages": [
      {
        "role": "user",
        "content": "Why is the sky blue?"
      }
    ]
  }'
Response · 200
{
    "id": "string",
    "type": "message",
    "role": "assistant",
    "model": "string",
    "content": [
        {
            "type": "text",
            "text": "string",
            "thinking": "string",
            "signature": "string",
            "id": "string",
            "name": "string",
            "input": {}
        }
    ],
    "stop_reason": "end_turn",
    "stop_sequence": "string",
    "usage": {
        "input_tokens": 0,
        "output_tokens": 0,
        "cache_creation_input_tokens": 0,
        "cache_read_input_tokens": 0
    }
}