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

# OpenAI Chat Completion

> Create a new AI completion. You can find the supported models using [List all AI models](/api-reference/ai/list-all-ai-models).



## OpenAPI

````yaml /openapi.yaml post /api/v1/openai/chat/completions
openapi: 3.1.0
info:
  title: Nuwacom API
  description: API for Nuwacom application
  version: 1.0.0
servers:
  - url: https://{customer-tenant}.nuwacom.ai
    description: Nuwacom API
security:
  - bearerAuth: []
paths:
  /api/v1/openai/chat/completions:
    post:
      tags:
        - Completion API
      summary: OpenAI Chat Completion
      description: >-
        Create a new AI completion. You can find the supported models using
        [List all AI models](/api-reference/ai/list-all-ai-models).
      operationId: postApiV1OpenaiChatCompletions
      parameters:
        - in: header
          name: x-space-id
          schema:
            type: string
          required: false
          description: >-
            Space ID to run the completion in. Used as a fallback when
            `space_id` is not set in the request body.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  anyOf:
                    - type: string
                      nullable: true
                  description: >-
                    Use this in the API call to specify the model to use for the
                    completion request. Is generally the model ID from the LLM
                    provider (e.g., "gpt-4o", "o1").
                imageGenerationModel:
                  enum:
                    - gemini-2.5-flash-image
                    - gemini-3-pro-image
                    - gemini-3.1-flash-image
                    - gemini-3.1-flash-image-eu
                    - imagen
                    - imagen-fast
                    - gpt-image-2
                    - gpt-image-2.5-sunburst
                    - flux-1-1-pro-ultra
                    - flux-1-kontext-pro
                    - flux-2-pro
                    - gemini-3-pro-image-preview
                    - gemini-3.1-flash-image-preview
                  description: >-
                    User-selected image generation model id. Overrides the
                    workspace default when present. Validated server-side
                    against the AI_ENABLED_IMAGE_MODELS feature flag.
                temperature:
                  type: number
                  description: >-
                    Sampling temperature. Higher values make responses more
                    adventurous; lower values keep them conservative.
                top_p:
                  type: number
                  description: >-
                    Nucleus sampling parameter. Use this instead of temperature
                    when you want to strictly cap how much of the probability
                    mass is considered.
                agentId:
                  anyOf:
                    - type: string
                      format: uuid
                      nullable: true
                  description: >-
                    Unique ID of the agent to use for the completion request.
                    Used to load the agent's full configuration (system prompt,
                    knowledge sources, etc.). NB: Agent must already be created
                    in the database and available for the space.
                agentPublished:
                  type: boolean
                  description: >-
                    Which version of the agent to use: true (default) =
                    published version, false = draft. Useful to test an agent
                    that has not been published yet.
                voiceId:
                  anyOf:
                    - type: string
                      format: uuid
                      nullable: true
                  description: >-
                    UUID of the Voice to use for the completion request. NB:
                    Voice must already be created in the database and available
                    for the space.
                taskId:
                  anyOf:
                    - type: string
                      format: uuid
                      nullable: true
                  description: >-
                    ID of the Task to use for the completion request. Used to
                    tie the completion back to a workflow step or scheduled job.
                    NB: Task must already be created in the database and
                    available for the space.
                capabilities:
                  type: object
                  properties:
                    webSearch:
                      type: boolean
                    knowledgeBaseSearch:
                      type: boolean
                    visionEnabled:
                      type: boolean
                    canvasEnabled:
                      type: boolean
                  required: []
                  description: >-
                    Provide an object of capabilities to enable the LLM perform
                    specific tasks better (e.g., web search, internal KB,
                    canvas, etc.).
                attachmentIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Array of asset IDs (files, snippets, etc.) that should be
                    injected into the completion request as supporting context.
                contentIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Array of Content document IDs to include in the RAG context.
                    Used to pass relevant document IDs so their content is
                    included as additional background information for the
                    completion request.
                folderIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Array of Folder IDs to include in the RAG context. When
                    provided, the LLM will use assets/documents within these
                    folders as additional background information for the
                    completion request.
                toolOptions:
                  type: object
                  properties:
                    language:
                      type: string
                    audience:
                      enum:
                        - c_level
                        - leaders_managers
                        - new_customers_prospects
                        - existing_customers
                        - internal_team_members
                        - partners_vendors
                    imageStyle:
                      enum:
                        - photorealistic
                        - illustration
                        - sketch
                        - comic
                    colorMood:
                      enum:
                        - vibrant
                        - warm
                        - cool
                        - monochrome
                        - pastel
                    documentTemplate:
                      enum:
                        - report
                        - article
                        - briefing
                        - social_media_post
                        - strategy_paper
                        - speech
                    templateId:
                      type: string
                    videoStyle:
                      enum:
                        - realistic
                        - cinematic
                        - motion_graphics
                        - animated
                    aspectRatio:
                      enum:
                        - horizontal
                        - vertical
                    sourceFilters:
                      type: object
                      properties:
                        docs:
                          type: boolean
                        notes:
                          type: boolean
                      required: []
                  required: []
                  description: >-
                    User preferences for AI behavior including language,
                    audience, and image generation style. These options are
                    injected into the system prompt.
                toolGroups:
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            enum:
                              - nuwacom
                          tools:
                            type: array
                            items:
                              type: string
                            minItems: 1
                        required:
                          - kind
                          - tools
                      - type: object
                        properties:
                          kind:
                            enum:
                              - paragon
                          integrationType:
                            type: string
                          integrationId:
                            anyOf:
                              - type: string
                                format: uuid
                                nullable: true
                          tools:
                            type: array
                            items:
                              type: string
                            minItems: 1
                        required:
                          - kind
                          - integrationType
                          - tools
                      - type: object
                        properties:
                          kind:
                            enum:
                              - mcp
                          mcpClientId:
                            type: string
                            format: uuid
                          integrationId:
                            anyOf:
                              - type: string
                                format: uuid
                                nullable: true
                          tools:
                            type: array
                            items:
                              type: string
                            minItems: 1
                        required:
                          - kind
                          - mcpClientId
                          - tools
                  description: >-
                    Grouped tool configurations keyed by provider context
                    (nuwacom, paragon integration type, or MCP client). Backend
                    expands these groups into per-tool configs.
                skillIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Skill IDs explicitly selected by the user from the skills
                    dropdown. When present without an agent, only these skills
                    are loaded.
                workflowContext:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    isWorkflowBuilder:
                      type: boolean
                    workflow_intent:
                      enum:
                        - create
                        - update
                    current_workflow:
                      type: object
                      properties:
                        nodes:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              type:
                                type: string
                              position:
                                type: object
                                properties:
                                  x:
                                    type: number
                                  'y':
                                    type: number
                                required:
                                  - x
                                  - 'y'
                              data:
                                type: object
                                properties:
                                  label:
                                    type: string
                                  type:
                                    type: string
                                  category:
                                    type: string
                                  config:
                                    type: object
                                    additionalProperties:
                                      $ref: '#/components/schemas/InlinedDef0_0'
                                required:
                                  - label
                                  - type
                                  - category
                                  - config
                            required:
                              - id
                              - position
                              - data
                        edges:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              source:
                                type: string
                              target:
                                type: string
                              sourceHandle:
                                anyOf:
                                  - type: string
                                    nullable: true
                              targetHandle:
                                anyOf:
                                  - type: string
                                    nullable: true
                            required:
                              - id
                              - source
                              - target
                      required:
                        - nodes
                        - edges
                    connected_integrations:
                      type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                          name:
                            type: string
                          credentialId:
                            anyOf:
                              - type: string
                                nullable: true
                        required:
                          - type
                          - name
                    canvas_workflow_id:
                      type: string
                  required:
                    - enabled
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: number
                      role:
                        enum:
                          - assistant
                          - user
                          - system
                      content:
                        anyOf:
                          - type: string
                          - type: array
                            items:
                              anyOf:
                                - type: object
                                  properties:
                                    type:
                                      enum:
                                        - text
                                    text:
                                      type: string
                                  required:
                                    - type
                                    - text
                                - type: object
                                  properties:
                                    type:
                                      enum:
                                        - image
                                    kbAssetId:
                                      type: string
                                      format: uuid
                                  required:
                                    - type
                                    - kbAssetId
                                - type: object
                                  properties:
                                    type:
                                      enum:
                                        - file_data
                                    data:
                                      type: string
                                    mediaType:
                                      type: string
                                    fileName:
                                      type: string
                                  required:
                                    - type
                                    - data
                                    - mediaType
                                    - fileName
                    required:
                      - role
                      - content
                  minItems: 1
                  description: >-
                    Ordered chat messages that make up the conversation history.
                    Always include the user’s latest turn; prepend prior turns
                    when you want additional context.
                stream:
                  type: boolean
                  description: >-
                    When true the API sends partial chunks as the model
                    generates them (ideal for typing indicators). Set to false
                    to receive a single response payload.
                parent_message_id:
                  anyOf:
                    - type: number
                      nullable: true
                  description: >-
                    Internal reference to the last assistant message in the
                    thread. Include this when you need the completion to
                    “continue” an earlier answer.
                conversation_id:
                  anyOf:
                    - type: string
                      format: uuid
                      nullable: true
                  description: >-
                    Conversation UUID tying multiple completions together.
                    Provide it to append to an existing thread; leave empty to
                    start fresh.
                space_id:
                  anyOf:
                    - anyOf:
                        - type: string
                          minLength: 2
                          maxLength: 6
                        - type: string
                          minLength: 21
                          maxLength: 21
                    - type: array
                      items:
                        anyOf:
                          - type: string
                            minLength: 2
                            maxLength: 6
                          - type: string
                            minLength: 21
                            maxLength: 21
                      minItems: 1
                  description: >-
                    Unique identifier of the space the completion should be run
                    in.
              required:
                - messages
                - space_id
      responses:
        '200':
          description: >-
            Successful completion response (see [OpenAI Completions
            Object](https://platform.openai.com/docs/api-reference/completions/object))
      externalDocs:
        description: OpenAI API documentation for chat completions
        url: https://platform.openai.com/docs/api-reference/chat/create
components:
  schemas:
    InlinedDef0_0:
      anyOf:
        - type: string
        - type: number
        - type: boolean
        - type: 'null'
        - type: array
          items:
            $ref: '#/components/schemas/InlinedDef0_0'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/InlinedDef0_0'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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