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

# Chat Completion Messages



## OpenAPI

````yaml https://sudoapp.dev/api/openapi.json get /v1/chat/completions/{completion_id}/messages
openapi: 3.1.0
info:
  title: sudo-api
  description: ''
  license:
    name: ''
  version: 0.1.0
servers: []
security:
  - api_key: []
  - privy_token: []
tags:
  - name: Sudo API
    description: 'Sudo: The Unified AI Developer Platform'
paths:
  /v1/chat/completions/{completion_id}/messages:
    get:
      tags:
        - Router
      summary: Chat Completion Messages
      operationId: get_chat_completion_messages
      parameters:
        - name: completion_id
          in: path
          description: ID of the chat completion
          required: true
          schema:
            type: string
        - name: after
          in: query
          description: >-
            Identifier for the last message from the previous pagination
            request.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Number of messages to retrieve.
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
        - name: order
          in: query
          description: >-
            Sort order for messages by timestamp. Use asc for ascending order or
            desc for descending order. Defaults to asc.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Chat completion messages gotten successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatMessageList'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Bad gateway error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key: []
components:
  schemas:
    ChatMessageList:
      type: object
      description: Represents a list of messages in a chat completion.
      required:
        - object
        - data
        - first_id
        - last_id
        - has_more
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ReturnedChatMessages'
          description: A list of chat messages.
        first_id:
          type: string
          description: The ID of the first message in the list.
        has_more:
          type: boolean
          description: Whether there are more messages to retrieve.
        last_id:
          type: string
          description: The ID of the last message in the list.
        object:
          type: string
          description: The object type, which is always `list`.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
    ReturnedChatMessages:
      type: object
      description: A chat message in a completion.
      required:
        - id
        - role
      properties:
        content:
          type:
            - string
            - 'null'
          description: The text content of the message.
        content_parts:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ContentPart'
          description: An array of content parts (for multi-part messages).
        id:
          type: string
          description: The unique identifier of the message.
        name:
          type:
            - string
            - 'null'
          description: An optional name for the participant.
        role:
          type: string
          description: The role of the message author (system, user, assistant, or tool).
    ErrorDetail:
      type: object
      required:
        - message
        - type
      properties:
        message:
          type: string
        type:
          type: string
    ContentPart:
      oneOf:
        - type: object
          description: Text content part
          required:
            - text
            - type
          properties:
            text:
              type: string
              description: The text content
            type:
              type: string
              enum:
                - input_text
        - type: object
          description: Image content part
          required:
            - detail
            - type
          properties:
            detail:
              type: string
              description: Level of detail for image processing ("low", "high", "auto")
            file_id:
              type:
                - string
                - 'null'
              description: ID of a previously uploaded file containing the image
            image_url:
              type:
                - string
                - 'null'
              description: URL of the image to process
            type:
              type: string
              enum:
                - input_image
        - type: object
          description: File content part for document processing
          required:
            - type
          properties:
            file_data:
              type:
                - string
                - 'null'
              description: Base64-encoded file data
            file_id:
              type:
                - string
                - 'null'
              description: ID of a previously uploaded file
            file_url:
              type:
                - string
                - 'null'
              description: URL of the file to process
            filename:
              type:
                - string
                - 'null'
              description: Name of the file
            type:
              type: string
              enum:
                - input_file
        - type: object
          description: Audio content part
          required:
            - input_audio
            - type
          properties:
            input_audio:
              $ref: '#/components/schemas/Audio'
              description: Audio input data and format
            type:
              type: string
              enum:
                - input_audio
      description: >-
        A part of message content, supporting different content types (text,
        images, files, audio) for multimodal input
    Audio:
      type: object
      description: Audio input data
      required:
        - data
        - format
      properties:
        data:
          type: string
          description: Base64-encoded audio data
        format:
          type: string
          description: Audio format (e.g., "wav", "mp3")

````