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

# Create Response

> Responses API endpoint — provider resolved dynamically from DB.

Auth:        Authorization: Bearer rsk_<ULID>
Streaming:   set stream=true for SSE chunks
Rate limits: RPM and RPD enforced per key via Redis fixed-window counters
Spend cap:   enforced if key.spend_cap_usd is set
Provider:    resolved from model_pricing.provider (same as chat/completions)



## OpenAPI

````yaml /api/openapi.json post /v1/responses
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: Create Response
      description: >-
        Responses API endpoint — provider resolved dynamically from DB.


        Auth:        Authorization: Bearer rsk_<ULID>

        Streaming:   set stream=true for SSE chunks

        Rate limits: RPM and RPD enforced per key via Redis fixed-window
        counters

        Spend cap:   enforced if key.spend_cap_usd is set

        Provider:    resolved from model_pricing.provider (same as
        chat/completions)
      operationId: create_response
      parameters:
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
            default: 2026-08
          example: 2026-08
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
            examples:
              default:
                summary: Example request
                value:
                  model: openai/gpt-5-pro
                  input: Explain quantum computing in one sentence.
                  stream: false
      responses:
        '200':
          description: >-
            Completed response (JSON), a queued background job when
            background=true, or an SSE stream when stream=true
          content:
            application/json:
              schema: {}
              examples:
                default:
                  summary: Successful responses API response
                  value:
                    id: resp_0543e9748a0f014a006a2b806f5e3481
                    object: response
                    created_at: 1781235823
                    status: completed
                    model: openai/gpt-4o
                    output:
                      - id: msg_0543e9748a0f014a006a2b80a0d14081
                        type: message
                        status: completed
                        role: assistant
                        content:
                          - type: output_text
                            text: >-
                              Quantum computers use quantum bits that can exist
                              in superposition, harnessing interference to solve
                              certain problems more efficiently than classical
                              computers.
                            annotations: []
                    usage:
                      input_tokens: 13
                      output_tokens: 63
                      total_tokens: 76
            text/event-stream:
              example: >+
                data:
                {"type":"response.created","response":{"id":"resp_abc","status":"in_progress"}}


                data: {"type":"response.output_text.delta","delta":"Hello"}


                data:
                {"type":"response.completed","response":{"status":"completed"}}

        '400':
          description: Model does not support Responses API
          content:
            application/json:
              example:
                error:
                  code: model_capability_not_supported
                  message: >-
                    Model 'meta-llama/llama-3.1-8b-instruct' does not support
                    the responses API.
                request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              example:
                error:
                  code: unauthorized
                  message: Invalid or missing API key.
                request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '402':
          description: Insufficient balance or spend cap reached
          content:
            application/json:
              examples:
                spend_cap_reached:
                  summary: Per-key spend cap reached
                  value:
                    error:
                      code: spend_limit_exceeded
                      message: >-
                        Spend cap of $10.0000 reached. Current spend: $10.0023.
                        Contact your administrator to increase the cap.
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
                no_balance:
                  summary: Insufficient credit balance
                  value:
                    error:
                      code: spend_limit_exceeded
                      message: >-
                        Insufficient balance. Top up your account to use paid
                        models.
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '403':
          description: API key is suspended
          content:
            application/json:
              example:
                error:
                  code: forbidden
                  message: API key is suspended.
                request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '422':
          description: Request validation failed
          content:
            application/json:
              example:
                error:
                  code: validation_error
                  message: Request validation failed.
                  details:
                    - type: missing
                      loc:
                        - body
                        - model
                      msg: Field required
                request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '429':
          description: Rate limit exceeded (RPM or RPD)
          content:
            application/json:
              examples:
                rpm_exceeded:
                  summary: Requests-per-minute limit hit
                  value:
                    error:
                      code: rate_limit_exceeded
                      message: RPM limit of 60 req/min exceeded.
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
                rpd_exceeded:
                  summary: Requests-per-day limit hit
                  value:
                    error:
                      code: rate_limit_exceeded
                      message: RPD limit of 1000 req/day exceeded.
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
        '500':
          description: Upstream provider error or gateway timeout
          content:
            application/json:
              examples:
                upstream_error:
                  summary: Upstream provider returned an error
                  value:
                    error:
                      code: upstream_error
                      message: Upstream provider returned an error.
                      upstream_detail: '{"error":{"message":"model_not_found","code":404}}'
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
                gateway_timeout:
                  summary: Upstream timed out
                  value:
                    error:
                      code: gateway_timeout
                      message: Upstream provider did not respond in time.
                    request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
                internal_error:
                  summary: >-
                    Internal platform error (DB failure — FastAPI default
                    format)
                  value:
                    detail: Internal Server Error
        '501':
          description: Provider adapter does not implement the Responses API
          content:
            application/json:
              example:
                detail: openai/o4-mini does not have support for Responses API.
        '503':
          description: Upstream provider temporarily unavailable
          content:
            application/json:
              example:
                error:
                  code: provider_not_available
                  message: >-
                    The model provider is temporarily unavailable. Please try
                    again shortly.
                request_id: req_01ARZ3NDEKTSV4RRFFQ69G5FAV
      security:
        - BearerAuth: []
components:
  schemas:
    ResponsesRequest:
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        input:
          anyOf:
            - type: string
            - items: {}
              type: array
          title: Input
        template:
          anyOf:
            - type: string
            - type: 'null'
          title: Template
        variables:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Variables
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
        stream:
          type: boolean
          title: Stream
          default: false
        max_output_tokens:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Output Tokens
        temperature:
          anyOf:
            - type: number
              maximum: 2
              minimum: 0
            - type: 'null'
          title: Temperature
        top_p:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Top P
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
        reasoning:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Reasoning
        tools:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/ResponsesFunctionTool'
                  - $ref: '#/components/schemas/BuiltinTool'
              type: array
            - type: 'null'
          title: Tools
        tool_choice:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tool Choice
        response_format:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Response Format
        plugins:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Plugins
        user:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: User
        previous_response_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous Response Id
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
        thinking:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Thinking
        caching:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Caching
        store:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Store
        background:
          type: boolean
          title: Background
          default: false
        include:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Include
        expire_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expire At
        max_tool_calls:
          anyOf:
            - type: integer
              maximum: 10
              minimum: 1
            - type: 'null'
          title: Max Tool Calls
        context_management:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Context Management
        text:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Text
        timeout:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: 'null'
          title: Timeout
      type: object
      required:
        - input
      title: ResponsesRequest
      example:
        input: Explain quantum computing in one sentence.
        model: openai/gpt-5-pro
        stream: false
    ResponsesFunctionTool:
      properties:
        type:
          type: string
          const: function
          title: Type
          default: function
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        parameters:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Parameters
        strict:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Strict
      type: object
      required:
        - name
      title: ResponsesFunctionTool
      description: >-
        Custom function tool in the Responses API flat format.


        The Responses API uses a flat structure (name/description/parameters at
        top

        level) unlike Chat Completions which nests them under a "function" key:

          Responses API:   {"type": "function", "name": "add", "parameters": {...}}
          Chat Completions: {"type": "function", "function": {"name": "add", ...}}
    BuiltinTool:
      properties:
        type:
          type: string
          enum:
            - image_generation
            - web_search_preview
            - web_search_preview_2025_03_11
            - file_search
            - computer_use_preview
            - code_interpreter
          title: Type
      additionalProperties: true
      type: object
      required:
        - type
      title: BuiltinTool
      description: >-
        Represents an OpenAI built-in tool (non-function), e.g. {"type":
        "image_generation"}.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) — sent as `Authorization: Bearer
        <key>`.

````