> ## Documentation Index
> Fetch the complete documentation index at: https://myco-29fc6df6-sweetmantech-myc-3925-docs-document-the-apiar.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream Chat

> Stream AI-powered chat responses using the Recoup chat system. This endpoint mirrors the request payload of the Chat Generate API but returns a streaming response compatible with the Vercel AI SDK `createUIMessageStreamResponse`. The stream emits UI message parts encoded as data chunks that can be parsed with `createUIMessageStreamParser`.



## OpenAPI

````yaml post /api/chat
openapi: 3.1.0
info:
  title: Recoup API
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://recoup-api.vercel.app
security:
  - apiKeyAuth: []
paths:
  /api/chat:
    post:
      description: >-
        Stream AI-powered chat responses using the Recoup chat system. This
        endpoint mirrors the request payload of the Chat Generate API but
        returns a streaming response compatible with the Vercel AI SDK
        `createUIMessageStreamResponse`. The stream emits UI message parts
        encoded as data chunks that can be parsed with
        `createUIMessageStreamParser`.
      requestBody:
        description: Chat stream request
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatStreamRequest'
      responses:
        '200':
          description: >-
            Streaming response with UI message parts. Events include:
            message-start (assistant begins message), message-delta (incremental
            updates), message-end (assistant finishes message), error (stream
            error), and metadata (usage data).
          content:
            text/event-stream:
              schema:
                type: string
                description: Server-Sent Events stream containing UI message parts
        '400':
          description: Bad request - missing required parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatStreamErrorResponse'
      security:
        - apiKeyAuth: []
      servers:
        - url: https://recoup-api.vercel.app
components:
  schemas:
    ChatStreamRequest:
      type: object
      description: >-
        Request body for chat streaming. Exactly one of 'prompt' or 'messages'
        must be provided.
      properties:
        prompt:
          type: string
          description: >-
            Single text prompt for the assistant. Required if 'messages' is not
            provided.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/UIMessage'
          description: >-
            Array of UIMessage objects for context. Required if 'prompt' is not
            provided.
        artistId:
          type: string
          format: uuid
          description: The unique identifier of the artist (optional)
        model:
          type: string
          description: The AI model to use for text generation (optional)
          example: openai/gpt-5-mini
        excludeTools:
          type: array
          items:
            type: string
          description: Array of tool names to exclude from execution
          example:
            - create_scheduled_actions
        roomId:
          type: string
          format: uuid
          description: >-
            UUID of the chat room. If not provided, one will be generated
            automatically.
    ChatStreamErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          description: Status of the request
        message:
          type: string
          description: Error message describing what went wrong
    UIMessage:
      type: object
      description: >-
        A message in the chat conversation. See
        https://ai-sdk.dev/docs/reference/ai-sdk-core/ui-message for details.
      properties:
        id:
          type: string
          description: Unique identifier for the message
        role:
          type: string
          enum:
            - user
            - assistant
            - system
          description: The role of the message sender
        content:
          type: string
          description: The text content of the message
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).

````