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

# AI assistant

> Send messages to the AI assistant and receive responses. Uses OpenAI models (defaults to GPT-4o-mini).



## OpenAPI

````yaml /api-reference/cx/swagger.json post /magic/_assistant
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /magic/_assistant:
    post:
      tags:
        - magic
      summary: AI assistant
      description: >-
        Send messages to the AI assistant and receive responses. Uses OpenAI
        models (defaults to GPT-4o-mini).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_magic.AssistantRequest'
        description: Assistant request with messages and optional model
        required: true
      responses:
        '200':
          description: AI assistant response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_magic.AssistantResponse'
        '400':
          description: Bad request - invalid request body or empty messages
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_magic.AssistantRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_magic.AssistantMessage'
        model:
          type: string
    pkg_routes_magic.AssistantResponse:
      type: object
      properties:
        result:
          type: string
    pkg_routes_magic.AssistantMessage:
      type: object
      properties:
        content:
          type: string
        role:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

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