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

# Create a response (OpenAI Responses API)

> Implements OpenAI's Responses API for text. Set `stream: true` for semantic-event SSE.



## OpenAPI

````yaml /openapi.yaml post /v1/responses
openapi: 3.1.0
info:
  title: Impossibl AI API
  version: 0.0.1
  description: >
    The Impossibl AI API is one API for all AI providers, OpenAI-compatible
    across OpenAI,

    Anthropic, Google, xAI, and more (`GET /v1/models` lists the full catalog),

    billed from a prepaid credit balance.


    Provider usage is billed at provider list prices with no usage markup.

    Prepaid credit purchases charge a separate fixed 5% platform fee before tax.


    **Agent quickstart**

    1. `POST /v1/accounts` — create a funded account; you get an API key and a
       signup-bonus balance in one call (no human step required).
    2. Call `POST /v1/chat/completions`, `POST /v1/responses`, or
       `POST /v1/audio/transcriptions` with
       `Authorization: Bearer <key>` and a `provider/model` id from `GET /v1/models`.
    3. Credits are deducted per request by token or audio-duration usage; check
    `GET /v1/account`.
servers:
  - url: https://api.impossibl.com
    description: Production
  - url: http://localhost:8787
    description: Local dev
security:
  - BearerKey: []
paths:
  /v1/responses:
    post:
      summary: Create a response (OpenAI Responses API)
      description: >-
        Implements OpenAI's Responses API for text. Set `stream: true` for
        semantic-event SSE.
      operationId: createResponse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
      responses:
        '200':
          description: >
            A `response` object. When `stream: true`, the body is instead an SSE

            stream of `response.*` semantic events ending with
            `response.completed`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseObject'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '404':
          $ref: '#/components/responses/UnknownModel'
        '502':
          $ref: '#/components/responses/UpstreamError'
        '503':
          $ref: '#/components/responses/ProviderNotConfigured'
components:
  schemas:
    ResponsesRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          example: anthropic/claude-sonnet-4-5
        input:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                description: >-
                  A role message, or a `function_call` / `function_call_output`
                  item on follow-up turns.
                properties:
                  type:
                    type: string
                    enum:
                      - message
                      - function_call
                      - function_call_output
                  role:
                    type: string
                    enum:
                      - system
                      - developer
                      - user
                      - assistant
                  content:
                    description: >-
                      A text string, or an array of input parts (input_text,
                      input_image, input_audio).
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          $ref: '#/components/schemas/ResponsesInputContentPart'
                  call_id:
                    type: string
                    description: Correlates a function_call and its function_call_output.
                  name:
                    type: string
                  arguments:
                    type: string
                    description: JSON-encoded arguments string (on function_call).
                  output:
                    type: string
                    description: Tool result text (on function_call_output).
        instructions:
          type: string
        stream:
          type: boolean
          default: false
        temperature:
          type: number
        top_p:
          type: number
        max_output_tokens:
          type: integer
        reasoning:
          type: object
          description: >-
            Stateless reasoning control. `summary` and stateful response
            chaining are not supported.
          properties:
            effort:
              type: string
              enum:
                - none
                - minimal
                - low
                - medium
                - high
                - xhigh
              nullable: true
        tools:
          type: array
          description: >-
            Function tools the model may call (relay mode). Function fields are
            flattened onto the tool.
          items:
            type: object
            required:
              - type
              - name
            properties:
              type:
                type: string
                const: function
              name:
                type: string
              description:
                type: string
              parameters:
                type: object
                description: JSON Schema for the tool input.
              strict:
                type: boolean
        tool_choice:
          description: '`auto`, `none`, `required`, or `{ type: function, name }`.'
          oneOf:
            - type: string
              enum:
                - auto
                - none
                - required
            - type: object
              properties:
                type:
                  type: string
                  const: function
                name:
                  type: string
    ResponseObject:
      type: object
      description: Responses API object (`response`).
      properties:
        id:
          type: string
          example: resp_...
        object:
          type: string
          const: response
        created_at:
          type: integer
        status:
          type: string
          enum:
            - in_progress
            - completed
            - failed
        model:
          type: string
        output_text:
          type: string
          description: Convenience aggregation of the assistant text.
        output:
          type: array
          description: >-
            Output items — assistant `message` items and, on tool calls,
            `function_call` items.
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - message
                  - function_call
              id:
                type: string
              status:
                type: string
              role:
                type: string
                const: assistant
                description: Present on `message` items.
              content:
                type: array
                description: Present on `message` items.
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      const: output_text
                    text:
                      type: string
                    annotations:
                      type: array
                      items:
                        type: object
              call_id:
                type: string
                description: Present on `function_call` items.
              name:
                type: string
                description: Present on `function_call` items.
              arguments:
                type: string
                description: >-
                  Present on `function_call` items: JSON-encoded arguments
                  string.
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            total_tokens:
              type: integer
    ResponsesInputContentPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - input_text
            - input_image
            - input_audio
        text:
          type: string
          description: Present when `type` is `input_text`.
        image_url:
          description: >-
            Present when `type` is `input_image`: an http(s) URL or a `data:`
            URI, as a string or `{ url }`.
          oneOf:
            - type: string
            - type: object
              properties:
                url:
                  type: string
        input_audio:
          type: object
          description: >-
            Present when `type` is `input_audio`. Only models advertising
            `audio` in `input_modalities` accept it.
          properties:
            data:
              type: string
              description: Base64-encoded audio (no data-URI prefix).
            format:
              type: string
              description: '`wav` or `mp3` (`aiff`, `aac`, `ogg`, `flac` also pass through).'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                One of authentication_error, invalid_request_error,
                insufficient_quota, upstream_error, provider_not_configured.
  responses:
    BadRequest:
      description: Malformed request (bad JSON, or missing required fields).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: '`model` and `messages` are required'
              type: invalid_request_error
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: authentication_error
    InsufficientCredits:
      description: The account's credit balance is empty. Top up to continue.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Insufficient credits. Top up to continue.
              type: insufficient_quota
    UnknownModel:
      description: The requested `model` id is not in the registry (see GET /v1/models).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: 'Unknown model: foo/bar'
              type: invalid_request_error
    UpstreamError:
      description: The upstream provider returned an error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: 'permission-denied: ...'
              type: upstream_error
    ProviderNotConfigured:
      description: The provider for this model has no API key configured on the gateway.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: 'Provider not configured: missing OPENAI_API_KEY'
              type: provider_not_configured
  securitySchemes:
    BearerKey:
      type: http
      scheme: bearer
      description: Gateway API key (`imp-rt-...`) from POST /v1/accounts or /v1/keys.

````