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

# Create a response (OpenAI-compatible, non-streaming)

> Creates a standard (non-streaming) completion response, compatible with the OpenAI response format. Use this endpoint as a drop-in replacement to create responses similar to OpenAI's chat/completions, but always returns the full response in a single payload. Requires API key authentication and is subject to rate limiting. Common use cases include chatbot interactions, assistant replies, and single-turn LLM completions.



## OpenAPI

````yaml https://api.swarms.world/openapi.json post /v1/responses
openapi: 3.1.0
info:
  title: Swarms API
  description: >-
    Swarms API provides scalable, secure orchestration for multi-agent systems.
    Access robust endpoints for managing agents and swarms, automating
    workflows, and monitoring execution. Requires an API key—see the [API Keys
    page](https://swarms.world/platform/api-keys). Refer to [Swarms API
    Documentation](https://docs.swarms.ai) for guides and details.
  version: 1.0.0
servers:
  - url: https://api.swarms.world
    description: Swarms Production API
security: []
paths:
  /v1/responses:
    post:
      tags:
        - OpenAI Compatible
        - Completions
        - Responses
        - Non-Streaming
        - LLM
        - v1
      summary: Create a response (OpenAI-compatible, non-streaming)
      description: >-
        Creates a standard (non-streaming) completion response, compatible with
        the OpenAI response format. Use this endpoint as a drop-in replacement
        to create responses similar to OpenAI's chat/completions, but always
        returns the full response in a single payload. Requires API key
        authentication and is subject to rate limiting. Common use cases include
        chatbot interactions, assistant replies, and single-turn LLM
        completions.
      operationId: create_response_v1_responses_post
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponseRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseObject'
        '400':
          description: An unsupported field or input item, named in the message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIErrorResponse'
        '404':
          description: Unknown model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ResponseRequest:
      properties:
        model:
          type: string
          title: Model
          description: >-
            Model to use. See GET /v1/models/available for the models you can
            use.
        input:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
          title: Input
          description: >-
            The user's text, or a list of message items with role user,
            assistant, system or developer. Message content is a string or a
            list of input_text and output_text parts. At least one user message
            is required; other item types and image or file parts return 400.
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: >-
            System prompt. Joined with any system or developer messages in
            input, in that order.
        max_output_tokens:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Output Tokens
          description: >-
            Maximum number of tokens to generate. When the limit is reached,
            status is incomplete with reason max_output_tokens.
        temperature:
          anyOf:
            - type: number
              maximum: 2
              minimum: 0
            - type: 'null'
          title: Temperature
          description: >-
            Sampling temperature, 0 to 2. Omitted by default so the model's own
            default applies.
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Top P
          description: Nucleus sampling cutoff.
      additionalProperties: true
      type: object
      required:
        - model
        - input
      title: ResponseRequest
      description: >-
        Request body for POST /v1/responses. Any other field set to a non-empty
        value, such as stream, tools or previous_response_id, returns 400 until
        it is supported.
    ResponseObject:
      properties:
        id:
          type: string
          title: Id
          description: Response identifier, resp_ prefixed.
        object:
          type: string
          const: response
          title: Object
          default: response
        created_at:
          type: integer
          title: Created At
          description: Unix time the response was created.
        model:
          type: string
          title: Model
          description: The model that answered.
        status:
          type: string
          enum:
            - completed
            - incomplete
          title: Status
          description: incomplete when max_output_tokens cut the answer short.
        incomplete_details:
          anyOf:
            - $ref: '#/components/schemas/IncompleteDetails'
            - type: 'null'
          description: Set only when status is incomplete.
        error:
          type: 'null'
          title: Error
          description: Always null; failures are HTTP errors.
        output:
          items:
            $ref: '#/components/schemas/ResponseOutputMessage'
          type: array
          title: Output
          description: One assistant message.
        usage:
          $ref: '#/components/schemas/ResponseUsage'
      type: object
      required:
        - id
        - created_at
        - model
        - status
        - output
        - usage
      title: ResponseObject
      description: A completed or incomplete response, in the OpenAI Responses API shape.
    OpenAIErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/OpenAIError'
      type: object
      required:
        - error
      title: OpenAIErrorResponse
      description: Error body in the OpenAI shape.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    IncompleteDetails:
      properties:
        reason:
          type: string
          const: max_output_tokens
          title: Reason
          description: Why generation stopped early.
      type: object
      required:
        - reason
      title: IncompleteDetails
    ResponseOutputMessage:
      properties:
        type:
          type: string
          const: message
          title: Type
          default: message
        id:
          type: string
          title: Id
          description: Message identifier, msg_ prefixed.
        role:
          type: string
          const: assistant
          title: Role
          default: assistant
        status:
          type: string
          enum:
            - completed
            - incomplete
          title: Status
          description: Same as the response status.
        content:
          items:
            $ref: '#/components/schemas/ResponseOutputText'
          type: array
          title: Content
          description: One output_text part.
      type: object
      required:
        - id
        - status
        - content
      title: ResponseOutputMessage
    ResponseUsage:
      properties:
        input_tokens:
          type: integer
          title: Input Tokens
          description: Prompt tokens billed.
        output_tokens:
          type: integer
          title: Output Tokens
          description: Generated tokens billed.
        total_tokens:
          type: integer
          title: Total Tokens
          description: input plus output.
        input_tokens_details:
          $ref: '#/components/schemas/InputTokensDetails'
        output_tokens_details:
          $ref: '#/components/schemas/OutputTokensDetails'
      type: object
      required:
        - input_tokens
        - output_tokens
        - total_tokens
        - input_tokens_details
        - output_tokens_details
      title: ResponseUsage
    OpenAIError:
      properties:
        message:
          type: string
          title: Message
        type:
          type: string
          title: Type
          description: invalid_request_error, or server_error.
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: model_not_found for an unknown model.
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
      type: object
      required:
        - message
        - type
      title: OpenAIError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ResponseOutputText:
      properties:
        type:
          type: string
          const: output_text
          title: Type
          default: output_text
        text:
          type: string
          title: Text
          description: The generated text.
        annotations:
          items: {}
          type: array
          title: Annotations
          description: Always empty.
      type: object
      required:
        - text
      title: ResponseOutputText
    InputTokensDetails:
      properties:
        cached_tokens:
          type: integer
          title: Cached Tokens
          description: Always 0; prompt caching is not reported.
          default: 0
      type: object
      title: InputTokensDetails
    OutputTokensDetails:
      properties:
        reasoning_tokens:
          type: integer
          title: Reasoning Tokens
          description: Always 0; reasoning tokens are not reported.
          default: 0
      type: object
      title: OutputTokensDetails

````

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