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

# Create Response

> OpenAI-compatible response generation. The request body follows the OpenAI Responses API.



## OpenAPI

````yaml /openapi.json post /response
openapi: 3.0.3
info:
  title: Reigent API
  version: 1.0.0
  description: API for managing Rei Agents and chat completions.
servers:
  - url: https://api.reilabs.org/v1
  - url: https://rei-api.reilabs.org/v1
security: []
paths:
  /response:
    servers:
      - url: https://rei-api.reilabs.org/v1
    post:
      tags:
        - Chat
      summary: Create Response
      description: >-
        OpenAI-compatible response generation. The request body follows the
        OpenAI Responses API.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - input
              properties:
                model:
                  type: string
                  enum:
                    - google/gemini-2.5-flash
                  description: Model to use. Defaults to agent's configured model.
                input:
                  description: >-
                    Text, image, or file inputs to the model. A string or an
                    array of input items.
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        $ref: '#/components/schemas/Message'
                instructions:
                  type: string
                  description: >-
                    System (developer) message inserted into the model's
                    context.
                max_output_tokens:
                  type: integer
                  minimum: 1
                  description: >-
                    Upper bound for the number of tokens generated, including
                    reasoning tokens.
                temperature:
                  type: number
                  minimum: 0
                  maximum: 2
                  default: 1
                top_p:
                  type: number
                  minimum: 0
                  maximum: 1
                stream:
                  type: boolean
                store:
                  type: boolean
                  description: Whether to store the generated response for later retrieval.
                previous_response_id:
                  type: string
                  description: >-
                    The unique ID of the previous response, used for multi-turn
                    conversations.
                parallel_tool_calls:
                  type: boolean
                  default: true
                metadata:
                  type: object
                  description: Set of key-value pairs that can be attached to the response.
                  additionalProperties:
                    type: string
                text:
                  type: object
                  description: Configuration options for the text response from the model.
                  properties:
                    format:
                      $ref: '#/components/schemas/ResponseFormat'
                tools:
                  type: array
                  items:
                    $ref: '#/components/schemas/Tool'
                tool_choice:
                  oneOf:
                    - type: string
                      enum:
                        - none
                        - auto
                        - required
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - function
                        name:
                          type: string
                      required:
                        - type
                        - name
      responses:
        '200':
          description: Response object
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                    example: response
                  created_at:
                    type: integer
                  model:
                    type: string
                  status:
                    type: string
                    enum:
                      - completed
                      - failed
                      - in_progress
                      - incomplete
                  output:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: message
                        id:
                          type: string
                        role:
                          type: string
                        content:
                          type: array
                          items:
                            type: object
                            properties:
                              type:
                                type: string
                                example: output_text
                              text:
                                type: string
                  output_text:
                    type: string
                    description: Aggregated text output from all output_text items.
                  usage:
                    $ref: '#/components/schemas/Usage'
        '400':
          description: Validation Error
        '401':
          description: Unauthorized
        '404':
          description: Agent not found
      security:
        - AgentSecretToken: []
components:
  schemas:
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/MessageContentPart'
        name:
          type: string
        tool_call_id:
          type: string
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ToolCall'
    ResponseFormat:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - json_object
            - json_schema
        json_schema:
          type: object
          required:
            - name
            - schema
          properties:
            name:
              type: string
            strict:
              type: boolean
              default: false
            schema:
              type: object
              properties:
                type:
                  type: string
                properties:
                  type: object
                required:
                  type: array
                  items:
                    type: string
                additionalProperties:
                  type: boolean
    Tool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
        function:
          type: object
          required:
            - name
            - parameters
          properties:
            name:
              type: string
            description:
              type: string
            parameters:
              type: object
            strict:
              type: boolean
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    MessageContentPart:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
            - file
            - file_url
        text:
          type: string
          description: Text content (required when type is 'text')
        image_url:
          type: object
          properties:
            url:
              type: string
          required:
            - url
        file:
          type: object
          properties:
            filename:
              type: string
            file_data:
              type: string
          required:
            - filename
            - file_data
        file_url:
          type: string
    ToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          type: object
          properties:
            name:
              type: string
            arguments:
              type: string
  securitySchemes:
    AgentSecretToken:
      type: http
      scheme: bearer
      description: Unit API Key

````