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

# Create a response

> Sends a request in the OpenAI Responses format. Only create and stream are served: a stored response cannot be fetched, listed or deleted.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/responses
openapi: 3.1.0
info:
  title: Altrum AI Gateway API
  version: 1.0.0
  description: >-
    The public API of the Altrum AI Gateway. It accepts the OpenAI, Anthropic
    and Gemini request formats, so an existing client needs only a new base URL
    and a virtual key.
servers:
  - url: https://api.altrum.ai
security:
  - bearer: []
  - apiKey: []
  - googleApiKey: []
  - altrumKey: []
tags:
  - name: OpenAI
  - name: Anthropic
  - name: Gemini
  - name: MCP
  - name: Health
paths:
  /v1/responses:
    post:
      tags:
        - OpenAI
      summary: Create a response
      description: >-
        Sends a request in the OpenAI Responses format. Only create and stream
        are served: a stored response cannot be fetched, listed or deleted.
      operationId: createResponse
      parameters:
        - $ref: '#/components/parameters/RequestIdIn'
        - $ref: '#/components/parameters/PromptId'
        - $ref: '#/components/parameters/PromptVersion'
        - $ref: '#/components/parameters/CacheKey'
        - $ref: '#/components/parameters/CacheTtl'
        - $ref: '#/components/parameters/CacheThreshold'
        - $ref: '#/components/parameters/CacheType'
        - $ref: '#/components/parameters/CacheNoStore'
        - $ref: '#/components/parameters/DisableContentLogging'
        - $ref: '#/components/parameters/DirectKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                An OpenAI Responses request. Every other field the OpenAI API
                accepts is passed to the model.
              required:
                - model
                - input
              properties:
                model:
                  type: string
                  description: >-
                    The provider and the model, such as `openai/gpt-4o-mini`. A
                    name without a provider is matched to one your organization
                    can serve.
                  example: openai/gpt-4o-mini
                input:
                  description: >-
                    Text, or a list of input items, in the OpenAI Responses
                    format.
                stream:
                  type: boolean
                  description: Stream the answer as server-sent events.
                fallbacks:
                  type: array
                  items:
                    type: string
                  description: >-
                    Models to try in order when an attempt fails. Altrum's
                    addition to the request body.
              additionalProperties: true
            example:
              model: openai/gpt-4o-mini
              input: Say hello.
      responses:
        '200':
          description: The response.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            x-alt-trace-id:
              $ref: '#/components/headers/TraceId'
            x-alt-provider:
              $ref: '#/components/headers/Provider'
            x-alt-resolved-model:
              $ref: '#/components/headers/ResolvedModel'
            x-alt-fallback-index:
              $ref: '#/components/headers/FallbackIndex'
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                example:
                  id: resp_123
                  object: response
                  status: completed
              example:
                id: resp_123
                object: response
                status: completed
            text/event-stream:
              schema:
                type: string
                description: >-
                  Sent when the request asks to stream. Events keep the format
                  of the API you called.
        '400':
          description: >-
            The request was refused: a guardrail stopped it, or the body or a
            header is not valid.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '401':
          description: No virtual key was sent, or the key does not exist or was revoked.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '402':
          description: A budget that covers this key is used up.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '403':
          description: >-
            The key, AI system, organization, model, provider or tool is not
            allowed.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '404':
          description: A prompt named in `x-alt-prompt-id` was not found.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '413':
          description: The request has more text than the guardrails can check at once.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '422':
          description: A guardrail stopped the reply.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '429':
          description: A rate limit that covers this key was reached.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '503':
          description: The guardrails could not be checked, or the provider is unavailable.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
components:
  parameters:
    RequestIdIn:
      name: x-request-id
      in: header
      required: false
      description: >-
        Your own reference for the request. Altrum uses it instead of making
        one, and returns it.
      schema:
        type: string
    PromptId:
      name: x-alt-prompt-id
      in: header
      required: false
      description: >-
        Use a prompt saved in your AI Gateway prompts. Its messages go before
        yours.
      schema:
        type: string
    PromptVersion:
      name: x-alt-prompt-version
      in: header
      required: false
      description: The prompt version to use, such as `2`. Without it, the latest version.
      schema:
        type: integer
    CacheKey:
      name: x-alt-cache-key
      in: header
      required: false
      description: >-
        Keeps this request's cached answers apart from others, for example per
        customer.
      schema:
        type: string
    CacheTtl:
      name: x-alt-cache-ttl
      in: header
      required: false
      description: >-
        Keeps the answer for less time than your setting: `30s`, `5m`, `1h` or a
        number of seconds.
      schema:
        type: string
      example: 5m
    CacheThreshold:
      name: x-alt-cache-threshold
      in: header
      required: false
      description: Asks for a closer match than your setting, from 0 to 1.
      schema:
        type: number
    CacheType:
      name: x-alt-cache-type
      in: header
      required: false
      description: '`direct` matches word for word only, `semantic` by meaning only.'
      schema:
        type: string
        enum:
          - direct
          - semantic
    CacheNoStore:
      name: x-alt-cache-no-store
      in: header
      required: false
      description: >-
        `true` serves from the cache when it can, but does not store this
        answer.
      schema:
        type: string
        enum:
          - 'true'
    DisableContentLogging:
      name: x-alt-disable-content-logging
      in: header
      required: false
      description: >-
        `true` keeps this request's prompt and reply out of the request log,
        even when your organization keeps content.
      schema:
        type: string
        enum:
          - 'true'
    DirectKey:
      name: x-alt-direct-key
      in: header
      required: false
      description: >-
        `true` sends your own provider key in `Authorization`, `x-api-key` or
        `x-goog-api-key`, with your virtual key in `x-alt-vk`. Only when your
        organization allows it.
      schema:
        type: string
        enum:
          - 'true'
  headers:
    RequestId:
      description: The request's reference. Quote it to support.
      schema:
        type: string
    TraceId:
      description: The trace the request belongs to.
      schema:
        type: string
    Provider:
      description: The provider that answered.
      schema:
        type: string
    ResolvedModel:
      description: The model that answered.
      schema:
        type: string
    FallbackIndex:
      description: 'Present when a fallback answered: `1` for the first fallback.'
      schema:
        type: integer
  schemas:
    OpenAIError:
      type: object
      description: An error on the OpenAI routes.
      required:
        - error
      properties:
        type:
          $ref: '#/components/schemas/RefusalCode'
        is_gateway_error:
          type: boolean
        status_code:
          type: integer
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
              description: A refusal code or a stable code.
            message:
              type: string
            param: {}
        request_id:
          type: string
        extra_fields:
          type: object
          additionalProperties: true
      example:
        type: budget_exceeded
        is_gateway_error: true
        status_code: 402
        error:
          type: budget_exceeded
          code: budget_exceeded
          message: 'Budget exceeded: ...'
        request_id: 4f9c...
    RefusalCode:
      type: string
      enum:
        - virtual_key_required
        - access_not_found
        - access_blocked
        - policy_access_denied
        - organization_inactive
        - gateway_disabled
        - ai_system_inactive
        - model_blocked
        - provider_blocked
        - mcp_tool_blocked
        - rate_limited
        - token_limited
        - request_limited
        - organization_concurrency_limit
        - budget_exceeded
        - access_unresolved
        - guardrail_blocked
        - response_blocked
        - guardrail_check_failed
        - payload_too_large
        - prompt_not_found
        - invalid_prompt_version
      description: Why Altrum refused the request.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        Your virtual key, `sk-alt-...`. What every OpenAI and Anthropic SDK
        sends.
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your virtual key, as Anthropic clients send it.
    googleApiKey:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: Your virtual key, as Gemini clients send it.
    altrumKey:
      type: apiKey
      in: header
      name: x-alt-vk
      description: >-
        Your virtual key. Needed when `Authorization` carries your own provider
        key (`x-alt-direct-key`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.