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

# OpenAI Format - Responses

> - Generic Responses API reference for all compatible models
- Server-side context storage: use previous_response_id for multi-turn conversations without manually passing history
- Supports streaming and non-streaming responses
- Multimodal input: supports text + image + file mixed input
- Tool calling: supports Function Calling and built-in tools
- Structured output: supports JSON Schema format




## OpenAPI

````yaml openapi/en/openai-format-responses.json POST /v1/responses
openapi: 3.1.0
info:
  title: OpenAI Format - Responses
  version: '1.0'
servers:
  - url: https://api.aihubmax.com
security:
  - BearerAuth: []
paths:
  /v1/responses:
    post:
      tags:
        - Text Series > OpenAI Format
      summary: OpenAI Format - Responses
      description: >
        - Generic Responses API reference for all compatible models

        - Server-side context storage: use previous_response_id for multi-turn
        conversations without manually passing history

        - Supports streaming and non-streaming responses

        - Multimodal input: supports text + image + file mixed input

        - Tool calling: supports Function Calling and built-in tools

        - Structured output: supports JSON Schema format
      operationId: openai-format-responses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponseRequest'
            examples:
              simple-input:
                summary: Simple Text Input
                description: Pass a text string directly as input
                value:
                  model: gpt-5.4
                  input: Explain the design principles of RESTful APIs
              multi-turn:
                summary: Multi-turn
                description: Multi-turn conversation via message list
                value:
                  model: gpt-5.4
                  input:
                    - role: developer
                      content: You are a travel planning assistant
                    - role: user
                      content: I want to visit Japan for 5 days with a budget of $3000
                    - role: assistant
                      content: >-
                        A 5-day Japan trip is a great choice! I suggest focusing
                        on the Kansai region (Osaka-Kyoto-Nara). Do you prefer
                        cultural experiences or food & shopping?
                    - role: user
                      content: Both, but cultural experiences first
              streaming:
                summary: Streaming
                description: Enable streaming output
                value:
                  model: gpt-5.4
                  input: Write a short article about AI applications in healthcare
                  stream: true
              previous-response:
                summary: Server-side Context (Multi-turn)
                description: >-
                  Use previous_response_id for multi-turn, no need to manually
                  pass history
                value:
                  model: gpt-5.4
                  input: What about the third principle? Can you give an example?
                  previous_response_id: resp_abc123
              tool-calling:
                summary: Tool Use - Weather
                description: Use Function Calling to invoke external tools
                value:
                  model: gpt-5.4
                  input: >-
                    Will it rain in London tomorrow? I'm planning to visit the
                    Tower Bridge
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Get weather forecast for a city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: City name
                            days:
                              type: integer
                              description: Forecast days
                              default: 1
                          required:
                            - city
      responses:
        '200':
          $ref: '#/components/responses/ResponseSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ResponseRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Model name
          example: gpt-5.4
        input:
          description: Text input or message list for generating a response
          oneOf:
            - type: string
              description: Text input for generating a response
            - type: array
              description: Input message list
              items:
                type: object
                required:
                  - role
                  - content
                properties:
                  role:
                    type: string
                    description: Role of the message sender
                    enum:
                      - system
                      - user
                      - assistant
                      - developer
                  content:
                    type: string
                    description: Message content
        stream:
          type: boolean
          description: Whether to stream the response
          default: false
        temperature:
          type: number
          description: Sampling temperature (0-2)
          minimum: 0
          maximum: 2
        max_output_tokens:
          type: integer
          description: Maximum number of output tokens to generate
        top_p:
          type: number
          description: Nucleus sampling parameter (0-1)
          minimum: 0
          maximum: 1
        previous_response_id:
          type: string
          description: ID of the previous response, used for multi-turn conversations
        instructions:
          type: string
          description: System-level instructions
        tools:
          type: array
          description: Available tools list
          items:
            type: object
            properties:
              type:
                type: string
                description: Tool type
                enum:
                  - function
                  - web_search
                  - file_search
                  - code_interpreter
              function:
                type: object
                description: Function definition (when type is function)
                properties:
                  name:
                    type: string
                    description: Function name
                  description:
                    type: string
                    description: Function description
                  parameters:
                    type: object
                    description: JSON Schema for function parameters
                required:
                  - name
        text:
          type: object
          description: Text output format configuration
          properties:
            format:
              type: object
              description: Output format
              properties:
                type:
                  type: string
                  description: Format type
                  enum:
                    - text
                    - json_object
                    - json_schema
    ResponseObject:
      type: object
      properties:
        id:
          type: string
          description: Unique response ID
          example: resp_abc123
        object:
          type: string
          description: Object type
          enum:
            - response
        created_at:
          type: integer
          description: Creation timestamp
          example: 1757165031
        model:
          type: string
          description: Model used
        status:
          type: string
          description: The status of the response
          enum:
            - completed
            - failed
            - in_progress
            - incomplete
          example: completed
        output:
          type: array
          description: List of output items
          items:
            type: object
            properties:
              type:
                type: string
                description: Output item type
                example: message
              id:
                type: string
                description: Output item ID
                example: msg_abc123
              role:
                type: string
                description: Role of the output
                example: assistant
              content:
                type: array
                description: Content list
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      description: Content type
                      example: output_text
                    text:
                      type: string
                      description: Generated text content
                      example: Hello! How can I help you today?
        usage:
          type: object
          description: Token usage statistics
          properties:
            input_tokens:
              type: integer
              description: Number of input tokens
              example: 20
            output_tokens:
              type: integer
              description: Number of output tokens
              example: 50
            total_tokens:
              type: integer
              description: Total number of tokens
              example: 70
    ErrorResponse400:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
    ErrorResponse401:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid API key
            type:
              type: string
              example: authentication_error
    ErrorResponse403:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Access denied
            type:
              type: string
              example: permission_error
    ErrorResponse429:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Rate limit exceeded
            type:
              type: string
              example: rate_limit_error
    ErrorResponse500:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Internal server error
            type:
              type: string
              example: server_error
  responses:
    ResponseSuccess:
      description: Response API success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseObject'
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse401'
    PaymentRequired:
      description: Insufficient balance
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse403'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse429'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse500'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        ## All APIs require Bearer Token authentication ##

        Add to request header:

        `Authorization: Bearer YOUR_API_KEY`

````