> ## Documentation Index
> Fetch the complete documentation index at: https://gomodel-docs-benchmark-writeup-and-tooling.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 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, OpenRouter, 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:
        max_tokens:
          type: integer
        messages:
          type: array
          items:
            $ref: '#/components/schemas/anthropicapi.Message'
        metadata:
          $ref: '#/components/schemas/anthropicapi.Metadata'
        model:
          type: string
        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:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          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
        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.ContentBlock:
      type: object
      properties:
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/anthropicapi.ContentBlock'
        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
        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:
        description:
          type: string
        input_schema:
          type: object
          additionalProperties: true
        name:
          type: string
        type:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````