> ## Documentation Index
> Fetch the complete documentation index at: https://gomodel.enterpilot.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a message (Anthropic Messages API)

> GoModel API reference for POST /v1/messages: Create a message (Anthropic Messages API).



## OpenAPI

````yaml /openapi.json post /v1/messages
openapi: 3.0.0
info:
  description: >-
    AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic,
    Gemini, Groq, Fireworks AI, Meta, OpenRouter, Kilo AI, DeepSeek, Z.ai, xAI,
    MiniMax, Xiaomi MiMo, OpenCode Go, Oracle, Ollama, Bailian). Drop-in
    OpenAI-compatible API.
  title: GoModel API
  contact: {}
  version: '1.0'
servers:
  - url: '{base_url}'
    description: Edit the base URL to point at your GoModel deployment.
    variables:
      base_url:
        default: http://localhost:8080
        description: Your GoModel deployment URL
security: []
paths:
  /v1/messages:
    post:
      tags:
        - messages
      summary: Create a message (Anthropic Messages API)
      requestBody:
        $ref: '#/components/requestBodies/anthropicapi.MessagesRequest'
      responses:
        '200':
          description: JSON response or SSE stream when stream=true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/anthropicapi.MessagesResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/anthropicapi.SSEEventFrame'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/anthropicapi.ErrorResponse'
      security:
        - BearerAuth: []
components:
  requestBodies:
    anthropicapi.MessagesRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/anthropicapi.MessagesRequest'
      description: Anthropic Messages request
      required: true
  schemas:
    anthropicapi.MessagesResponse:
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/anthropicapi.ResponseContentBlock'
        id:
          type: string
        model:
          type: string
        role:
          type: string
        stop_reason:
          type: string
        stop_sequence:
          type: string
        type:
          type: string
        usage:
          $ref: '#/components/schemas/anthropicapi.Usage'
    anthropicapi.SSEEventFrame:
      description: >-
        One server-sent event frame emitted by streaming /v1/messages. On the
        wire each frame is sent as event: <name> and data: <JSON payload>.
        Unknown event payloads are accepted for forward compatibility.
      anyOf:
        - $ref: '#/components/schemas/anthropicapi.SSEMessageStartEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEContentBlockStartEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEContentBlockDeltaEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEContentBlockStopEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEMessageDeltaEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEMessageStopEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEPingEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEErrorEvent'
        - $ref: '#/components/schemas/anthropicapi.SSEUnknownEvent'
    anthropicapi.ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/anthropicapi.ErrorObject'
        type:
          type: string
    anthropicapi.MessagesRequest:
      type: object
      properties:
        cache_control:
          type: object
        max_tokens:
          type: integer
        messages:
          type: array
          items:
            $ref: '#/components/schemas/anthropicapi.Message'
        metadata:
          $ref: '#/components/schemas/anthropicapi.Metadata'
        model:
          type: string
        output_config:
          description: >-
            OutputConfig carries structured output (format) and the effort
            level.
          allOf:
            - $ref: '#/components/schemas/anthropicapi.OutputConfig'
        output_format:
          description: >-
            OutputFormat is the deprecated top-level form of
            output_config.format.
          type: object
        stop_sequences:
          type: array
          items:
            type: string
        stream:
          type: boolean
        system:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/anthropicapi.ContentBlock'
        temperature:
          type: number
        thinking:
          $ref: '#/components/schemas/anthropicapi.Thinking'
        tool_choice:
          $ref: '#/components/schemas/anthropicapi.ToolChoice'
        tools:
          type: array
          items:
            $ref: '#/components/schemas/anthropicapi.Tool'
        top_k:
          type: integer
        top_p:
          type: number
    anthropicapi.ResponseContentBlock:
      type: object
      properties:
        data:
          description: Data is the opaque payload of a redacted_thinking block.
          type: string
        extra_content:
          description: >-
            ExtraContent is provider replay state on a tool_use block; clients
            echo

            it back on the next turn (see core.ExtraContentField).
          type: object
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
        signature:
          description: >-
            Signature authenticates a thinking block. Anthropic requires it back

            verbatim when the conversation continues, so clients must echo it.
            Every

            thinking block carries the member, as the Anthropic schema requires;

            reasoning from a provider that does not sign its output is rendered
            with

            an empty signature. Hence the pointer: only a thinking block has
            one.
          type: string
        text:
          type: string
        thinking:
          type: string
        type:
          type: string
    anthropicapi.Usage:
      type: object
      properties:
        cache_creation_input_tokens:
          type: integer
        cache_read_input_tokens:
          type: integer
        input_tokens:
          type: integer
        output_tokens:
          type: integer
    anthropicapi.SSEMessageStartEvent:
      type: object
      required:
        - message
        - type
      properties:
        type:
          type: string
          enum:
            - message_start
        message:
          $ref: '#/components/schemas/anthropicapi.MessagesResponse'
    anthropicapi.SSEContentBlockStartEvent:
      type: object
      required:
        - content_block
        - index
        - type
      properties:
        type:
          type: string
          enum:
            - content_block_start
        index:
          type: integer
        content_block:
          $ref: '#/components/schemas/anthropicapi.ResponseContentBlock'
    anthropicapi.SSEContentBlockDeltaEvent:
      type: object
      required:
        - delta
        - index
        - type
      properties:
        type:
          type: string
          enum:
            - content_block_delta
        index:
          type: integer
        delta:
          type: object
          additionalProperties: true
    anthropicapi.SSEContentBlockStopEvent:
      type: object
      required:
        - index
        - type
      properties:
        type:
          type: string
          enum:
            - content_block_stop
        index:
          type: integer
    anthropicapi.SSEMessageDeltaEvent:
      type: object
      required:
        - delta
        - type
      properties:
        type:
          type: string
          enum:
            - message_delta
        delta:
          type: object
          additionalProperties: true
        usage:
          $ref: '#/components/schemas/anthropicapi.Usage'
    anthropicapi.SSEMessageStopEvent:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - message_stop
    anthropicapi.SSEPingEvent:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - ping
    anthropicapi.SSEErrorEvent:
      type: object
      required:
        - error
        - type
      properties:
        type:
          type: string
          enum:
            - error
        error:
          $ref: '#/components/schemas/anthropicapi.ErrorObject'
    anthropicapi.SSEUnknownEvent:
      description: Fallback for future Anthropic streaming event payloads.
      type: object
      required:
        - type
      properties:
        type:
          type: string
      additionalProperties: true
    anthropicapi.ErrorObject:
      type: object
      properties:
        message:
          type: string
        provider:
          description: |-
            Provider names the upstream provider that produced the error. It is
            omitted for errors raised by the gateway itself.
          type: string
        type:
          type: string
    anthropicapi.Message:
      type: object
      properties:
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/anthropicapi.ContentBlock'
        role:
          type: string
    anthropicapi.Metadata:
      type: object
      properties:
        user_id:
          type: string
    anthropicapi.OutputConfig:
      type: object
      properties:
        effort:
          type: string
        format:
          type: object
    anthropicapi.ContentBlock:
      type: object
      properties:
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/anthropicapi.ContentBlock'
        extra_content:
          type: object
          additionalProperties: true
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        is_error:
          type: boolean
        name:
          type: string
        source:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        text:
          type: string
        thinking:
          type: string
        signature:
          type: string
        data:
          type: string
        tool_use_id:
          type: string
        type:
          type: string
    anthropicapi.Thinking:
      type: object
      properties:
        budget_tokens:
          type: integer
        type:
          type: string
    anthropicapi.ToolChoice:
      type: object
      properties:
        disable_parallel_tool_use:
          type: boolean
        name:
          type: string
        type:
          type: string
    anthropicapi.Tool:
      type: object
      properties:
        cache_control:
          type: object
        defer_loading:
          description: >-
            DeferLoading marks a tool whose schema the API loads only when tool

            search matches it. It is an ordinary custom tool that declares
            itself

            deferred, so the translated pipeline sends it like any other and
            drops

            the marker (see convertTools).
          type: boolean
        description:
          type: string
        input_schema:
          type: object
          additionalProperties: true
        name:
          type: string
        strict:
          type: boolean
        type:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.