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

# Create response

> Creates a comprehensive AI response with support for conversations, tools, files, and streaming



## OpenAPI

````yaml /openapi.json post /responses
openapi: 3.0.3
info:
  title: AnyAPI API
  description: >-
    Universal API Integration Platform - Connect any API to any API with
    intelligent data transformation and workflow orchestration.
  version: 1.0.0
  contact:
    name: AnyAPI Support
    email: support@anyapi.ai
    url: https://anyapi.ai/support
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.anyapi.ai/v1
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Text
    description: Generate text completions
  - name: Images
    description: Generate and manipulate images
  - name: Audio
    description: Generate speech and transcribe audio
  - name: Music
    description: List and retrieve model information
  - name: Video
    description: Create vector embeddings for text
  - name: Vision
    description: Create vector embeddings for text
  - name: 3D Models
    description: Create vector embeddings for text
  - name: Embeddings
    description: Create vector embeddings for text
  - name: Files
    description: Files
  - name: Batches
    description: Batches
  - name: Moderation
    description: Moderation
  - name: Other
    description: Other models
paths:
  /responses:
    post:
      tags:
        - Responses
      summary: Create response
      description: >-
        Creates a comprehensive AI response with support for conversations,
        tools, files, and streaming
      operationId: createResponse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateResponseRequest'
            examples:
              Basic:
                summary: Basic request
                description: Simple request with model and input text
                value:
                  model: openai/gpt-4o
                  input: Tell me about AI
              With temperature:
                summary: With temperature
                description: Adjusts creativity level using temperature parameter
                value:
                  model: openai/gpt-4o
                  input: Write a creative story about a robot
                  temperature: 0.9
              With max_tokens:
                summary: With max_tokens
                description: Limits the length of the response using max_tokens
                value:
                  model: openai/gpt-4o
                  input: Explain quantum computing
                  max_tokens: 500
              Conversation:
                summary: Conversation with message history
                description: Sends full conversation history with multiple messages
                value:
                  model: openai/gpt-4o
                  conversation:
                    messages:
                      - role: user
                        content: Hello! How are you?
                      - role: assistant
                        content: I'm doing well, thank you! How can I help you today?
                      - role: user
                        content: Tell me about the weather
              Conversation ID:
                summary: Using conversation ID
                description: References existing conversation by ID for context continuity
                value:
                  model: openai/gpt-4o
                  conversation: conv_abc123xyz
                  input: Can you elaborate on that?
              New dialog with system message:
                summary: System message for context
                description: >-
                  Starts conversation with system message to set assistant
                  behavior
                value:
                  model: openai/gpt-4o
                  conversation:
                    messages:
                      - role: system
                        content: >-
                          You are a helpful math tutor. Explain concepts
                          clearly.
                      - role: user
                        content: What is calculus?
              Web Search:
                summary: Web search tool
                description: Enables web search capability to find current information
                value:
                  model: openai/gpt-4o
                  input: What are the latest news about AI today?
                  tools:
                    - type: web_search
              File Search:
                summary: File search tool
                description: Searches through uploaded documents for relevant information
                value:
                  model: openai/gpt-4o
                  input: >-
                    Find information about quarterly sales in the uploaded
                    documents
                  tools:
                    - type: file_search
              Code Interpreter:
                summary: Code interpreter tool
                description: Executes Python code for calculations and data analysis
                value:
                  model: openai/gpt-4o
                  input: Calculate the first 10 Fibonacci numbers
                  tools:
                    - type: code_interpreter
              Multiple tools:
                summary: Multiple tools combined
                description: Uses multiple tools together for complex tasks
                value:
                  model: openai/gpt-4o
                  input: >-
                    Research the latest Python libraries and create a comparison
                    chart
                  tools:
                    - type: web_search
                    - type: code_interpreter
              All tools:
                summary: All available tools
                description: Enables all three tools for maximum capability
                value:
                  model: openai/gpt-4o
                  input: >-
                    Find recent research papers on machine learning, summarize
                    them, and create visualizations
                  tools:
                    - type: web_search
                    - type: file_search
                    - type: code_interpreter
              Include web_search sources:
                summary: Include web search sources
                description: Returns web search sources in the response
                value:
                  model: openai/gpt-4o
                  input: What happened in tech news yesterday?
                  tools:
                    - type: web_search
                  include:
                    - web_search
              Include code_interpreter outputs:
                summary: Include code outputs
                description: Returns code execution outputs and generated files
                value:
                  model: openai/gpt-4o
                  input: Plot a sine wave from 0 to 2π
                  tools:
                    - type: code_interpreter
                  include:
                    - code_interpreter.outputs
              Include multiple:
                summary: Include multiple tool outputs
                description: Returns outputs from multiple tools in the response
                value:
                  model: openai/gpt-4o
                  input: Research AI trends and create a visualization
                  tools:
                    - type: web_search
                    - type: code_interpreter
                  include:
                    - web_search
                    - code_interpreter.outputs
              Single image URL:
                summary: Image from URL
                description: Analyzes image provided via URL
                value:
                  model: openai/gpt-4o
                  input:
                    - type: text
                      text: What's in this image?
                    - type: image_url
                      image_url:
                        url: https://example.com/image.jpg
              Image base64:
                summary: Image in base64 format
                description: Analyzes image provided as base64-encoded data
                value:
                  model: openai/gpt-4o
                  input:
                    - type: text
                      text: Describe this image
                    - type: image_url
                      image_url:
                        url: data:image/jpeg;base64,/9j/4AAQSkZJRg...
                        detail: high
              Multiple images:
                summary: Multiple images
                description: Analyzes and compares multiple images
                value:
                  model: openai/gpt-4o
                  input:
                    - type: text
                      text: Compare these two images
                    - type: image_url
                      image_url:
                        url: https://example.com/image1.jpg
                    - type: image_url
                      image_url:
                        url: https://example.com/image2.jpg
              File input:
                summary: File input for search
                description: Provides file for analysis with file_search tool
                value:
                  model: openai/gpt-4o
                  input: Summarize this document
                  files:
                    - file_id: file-abc123
                  tools:
                    - type: file_search
              Multiple files:
                summary: Multiple files
                description: Analyzes multiple documents together
                value:
                  model: openai/gpt-4o
                  input: Compare information across these documents
                  files:
                    - file_id: file-abc123
                    - file_id: file-xyz789
                  tools:
                    - type: file_search
              Background processing:
                summary: Background processing
                description: Processes request in background for long-running tasks
                value:
                  model: openai/gpt-4o
                  input: Generate a comprehensive market analysis report
                  tools:
                    - type: web_search
                    - type: code_interpreter
                  background: true
              Background with callback:
                summary: Background with webhook
                description: Background processing with webhook callback when complete
                value:
                  model: openai/gpt-4o
                  input: Process this large dataset and create visualizations
                  tools:
                    - type: code_interpreter
                  files:
                    - file_id: file-large-dataset
                  background: true
                  webhook_url: https://your-app.com/webhook
              With metadata:
                summary: Request with metadata
                description: Includes custom metadata for tracking and organization
                value:
                  model: openai/gpt-4o
                  input: Analyze customer feedback
                  metadata:
                    user_id: user_12345
                    session_id: session_abc
                    request_type: analysis
              Web research with conversation:
                summary: Web research in conversation
                description: Combines conversation context with web search capabilities
                value:
                  model: openai/gpt-4o
                  conversation:
                    messages:
                      - role: user
                        content: I'm researching renewable energy
                  input: What are the latest developments in solar panel technology?
                  tools:
                    - type: web_search
                  include:
                    - web_search
                  temperature: 0.7
              Image analysis with code interpreter:
                summary: Image + code analysis
                description: Analyzes images and generates code or visualizations
                value:
                  model: openai/gpt-4o
                  input:
                    - type: text
                      text: >-
                        Analyze the data in this chart and recreate it with
                        updated styling
                    - type: image_url
                      image_url:
                        url: https://example.com/chart.png
                  tools:
                    - type: code_interpreter
                  include:
                    - code_interpreter.outputs
              Document analysis with web search:
                summary: Document + web search
                description: Compares document content with current online information
                value:
                  model: openai/gpt-4o
                  input: >-
                    Compare the information in this document with current online
                    sources
                  files:
                    - file_id: file-report-2023
                  tools:
                    - type: file_search
                    - type: web_search
                  include:
                    - web_search
              Multi-step research task:
                summary: Complex multi-step research
                description: >-
                  Comprehensive research task with system instructions and
                  multiple tools
                value:
                  model: openai/gpt-4o
                  conversation:
                    messages:
                      - role: system
                        content: >-
                          You are a research assistant. Provide detailed,
                          well-sourced analysis.
                      - role: user
                        content: I need to understand market trends
                  input: >-
                    Research competitors in the EV market, analyze their
                    strategies, and create comparison charts
                  tools:
                    - type: web_search
                    - type: code_interpreter
                  include:
                    - web_search
                    - code_interpreter.outputs
                  max_tokens: 2000
                  temperature: 0.5
              Code analysis with file:
                summary: Code file analysis
                description: Reviews code files for bugs and improvements
                value:
                  model: openai/gpt-4o
                  input: Review this code file for bugs and suggest improvements
                  files:
                    - file_id: file-python-script
                  tools:
                    - type: code_interpreter
                    - type: file_search
                  include:
                    - code_interpreter.outputs
              Data visualization task:
                summary: Data visualization
                description: Creates visualizations and dashboards from data files
                value:
                  model: openai/gpt-4o
                  input: Create a dashboard with sales trends from the uploaded CSV
                  files:
                    - file_id: file-sales-data-csv
                  tools:
                    - type: code_interpreter
                  include:
                    - code_interpreter.outputs
                  temperature: 0.3
              Stream mode:
                summary: Streaming response
                description: Streams the response in real-time as it's generated
                value:
                  model: openai/gpt-4o
                  input: Write a long article about artificial intelligence
                  stream: true
              Stream with tools:
                summary: Streaming with tools
                description: Streams response while using tools
                value:
                  model: openai/gpt-4o
                  input: Research and write about quantum computing advances
                  tools:
                    - type: web_search
                  include:
                    - web_search
                  stream: true
              Multi-modal analysis:
                summary: Multi-modal comprehensive analysis
                description: Combines images, conversation context, and multiple tools
                value:
                  model: openai/gpt-4o
                  conversation:
                    messages:
                      - role: system
                        content: You are a data analyst expert
                  input:
                    - type: text
                      text: >-
                        Analyze this chart, search for related market data, and
                        provide insights
                    - type: image_url
                      image_url:
                        url: https://example.com/market-chart.png
                        detail: high
                  tools:
                    - type: web_search
                    - type: code_interpreter
                  include:
                    - web_search
                    - code_interpreter.outputs
                  max_tokens: 3000
              Research paper analysis:
                summary: Research paper analysis
                description: Analyzes research papers and compares with latest findings
                value:
                  model: openai/gpt-4o
                  input: Summarize key findings and compare with latest research
                  files:
                    - file_id: file-research-paper-pdf
                  tools:
                    - type: file_search
                    - type: web_search
                  include:
                    - web_search
                  metadata:
                    project: literature-review
                    topic: machine-learning
              Automated report generation:
                summary: Automated reporting
                description: Generates comprehensive reports with charts in background
                value:
                  model: openai/gpt-4o
                  input: >-
                    Generate a comprehensive weekly report with charts and data
                    analysis
                  files:
                    - file_id: file-weekly-data
                  tools:
                    - type: code_interpreter
                    - type: web_search
                  include:
                    - code_interpreter.outputs
                    - web_search
                  background: true
                  webhook_url: https://your-app.com/reports/webhook
                  metadata:
                    report_type: weekly
                    department: sales
              Maximum parameters:
                summary: All available parameters
                description: Demonstrates maximum capability with all parameters combined
                value:
                  model: openai/gpt-4o
                  conversation:
                    messages:
                      - role: system
                        content: You are an expert research analyst
                      - role: user
                        content: I need comprehensive market analysis
                  input:
                    - type: text
                      text: >-
                        Analyze this market data, search for competitor
                        information, and create visualizations
                    - type: image_url
                      image_url:
                        url: https://example.com/data-chart.png
                        detail: high
                  files:
                    - file_id: file-market-report
                  tools:
                    - type: web_search
                    - type: file_search
                    - type: code_interpreter
                  include:
                    - web_search
                    - code_interpreter.outputs
                  max_tokens: 4000
                  temperature: 0.7
                  stream: false
                  background: false
                  metadata:
                    user_id: user_xyz
                    project: market-analysis
                    priority: high
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateResponseResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/CreateResponseStreamResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateResponseRequest:
      type: object
      required:
        - model
      properties:
        model:
          type: string
          description: ID of the model to use
          example: openai/gpt-4o
        input:
          oneOf:
            - type: string
              description: Text input for the model
            - type: array
              description: Array of content parts (text and/or images)
              items:
                oneOf:
                  - $ref: '#/components/schemas/ChatCompletionMessageContentPartText'
                  - $ref: '#/components/schemas/ChatCompletionMessageContentPartImage'
        conversation:
          oneOf:
            - type: string
              description: Conversation ID to continue an existing conversation
            - type: object
              description: Conversation object with message history
              properties:
                messages:
                  type: array
                  items:
                    $ref: '#/components/schemas/ChatCompletionMessage'
        tools:
          type: array
          description: List of tools available to the model
          items:
            type: object
            required:
              - type
            properties:
              type:
                type: string
                enum:
                  - web_search
                  - file_search
                  - code_interpreter
                description: Type of tool to enable
        files:
          type: array
          description: List of files to attach to the request
          items:
            type: object
            required:
              - file_id
            properties:
              file_id:
                type: string
                description: The ID of the file to use
        include:
          type: array
          description: List of additional data to include in the response
          items:
            type: string
            enum:
              - web_search
              - file_search
              - code_interpreter.outputs
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate
          minimum: 1
        temperature:
          type: number
          description: Sampling temperature between 0 and 2
          minimum: 0
          maximum: 2
          default: 1
        stream:
          type: boolean
          description: Whether to stream the response
          default: false
        background:
          type: boolean
          description: Process request in background and notify via webhook
          default: false
        webhook_url:
          type: string
          format: uri
          description: Webhook URL for background processing notifications
        metadata:
          type: object
          description: Arbitrary metadata to attach to the request
          additionalProperties: true
    CreateResponseResponse:
      type: object
      required:
        - id
        - object
        - created
        - model
        - content
      properties:
        id:
          type: string
          description: Unique identifier for the response
        object:
          type: string
          enum:
            - response
          description: Object type, always 'response'
        created:
          type: integer
          description: Unix timestamp of when the response was created
        model:
          type: string
          description: The model used for generating the response
        content:
          type: string
          description: The generated response content
        conversation_id:
          type: string
          description: ID of the conversation if part of a conversation
        tools_used:
          type: array
          description: List of tools that were used in generating the response
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - web_search
                  - file_search
                  - code_interpreter
              result:
                type: object
                description: Tool execution result
        usage:
          $ref: '#/components/schemas/CompletionUsage'
        metadata:
          type: object
          description: Metadata attached to the request
          additionalProperties: true
    CreateResponseStreamResponse:
      type: object
      required:
        - id
        - object
        - created
        - model
        - delta
      properties:
        id:
          type: string
          description: Unique identifier for the response
        object:
          type: string
          enum:
            - response.chunk
          description: Object type, always 'response.chunk'
        created:
          type: integer
          description: Unix timestamp of when the response was created
        model:
          type: string
          description: The model used for generating the response
        delta:
          type: object
          description: Incremental content update
          properties:
            content:
              type: string
              description: Content chunk
              nullable: true
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
          description: Reason why the stream ended
          nullable: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              description: A human-readable error message
            type:
              type: string
              description: The type of error
            code:
              type: string
              description: An error code identifying the error type
    ChatCompletionMessageContentPartText:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
          description: The text content
    ChatCompletionMessageContentPartImage:
      type: object
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          enum:
            - image_url
        image_url:
          type: object
          required:
            - url
          properties:
            url:
              type: string
              format: uri
              description: Either a URL of the image or the base64 encoded image data
            detail:
              type: string
              enum:
                - auto
                - low
                - high
              description: Specifies the detail level of the image
              default: auto
    ChatCompletionMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
            - developer
            - tool
          description: The role of the messages author
        content:
          oneOf:
            - type: string
              description: The contents of the message
            - type: array
              description: An array of content parts with a defined type
              items:
                $ref: '#/components/schemas/ChatCompletionMessageContentPart'
        name:
          type: string
          description: An optional name for the participant
        tool_calls:
          type: array
          description: The tool calls generated by the model
          items:
            $ref: '#/components/schemas/ChatCompletionMessageToolCall'
        tool_call_id:
          type: string
          description: Tool call that this message is responding to
    CompletionUsage:
      type: object
      properties:
        completion_tokens:
          type: integer
          description: Number of tokens in the generated completion
        prompt_tokens:
          type: integer
          description: Number of tokens in the prompt
        total_tokens:
          type: integer
          description: Total number of tokens used in the request
      required:
        - completion_tokens
        - prompt_tokens
        - total_tokens
    ChatCompletionMessageContentPart:
      oneOf:
        - $ref: '#/components/schemas/ChatCompletionMessageContentPartText'
        - $ref: '#/components/schemas/ChatCompletionMessageContentPartImage'
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/ChatCompletionMessageContentPartText'
          image_url:
            $ref: '#/components/schemas/ChatCompletionMessageContentPartImage'
    ChatCompletionMessageToolCall:
      type: object
      required:
        - id
        - type
        - function
      properties:
        id:
          type: string
          description: The ID of the tool call
        type:
          type: string
          enum:
            - function
        function:
          type: object
          required:
            - name
            - arguments
          properties:
            name:
              type: string
              description: The name of the function to call
            arguments:
              type: string
              description: >-
                The arguments to call the function with, as generated by the
                model in JSON format
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Get your API key from the dashboard.

````