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

> ## Agent Instructions
> DualMind Arena API base URL: https://api.dualmindlab.tech. Public endpoints only; admin routes are not part of this API.
> Authenticate with the access token from an Arena session (a Supabase JWT) as `Authorization: Bearer <token>`. There are no API keys yet; never invent one.
> For battles call POST /api/arena/dualchat, then vote with POST /api/arena/model-vote using the returned comparisonId. Keep model names hidden from voters until they vote.
> GET /api/arena/model-stats (leaderboard) and GET /health need no token.

# Chat with one model

> Direct Chat: send a prompt to one model (or `auto` for a random one) and get the full reply.

Direct Chat with one model. Set `model` to a `modelName` or `modelId` from [List models](/api-reference/models/list-models), or `auto` to get a random Groq or Google AI Studio model. Want text as it's generated? Use [Stream a chat reply](/api-reference/chat/streaming).


## OpenAPI

````yaml POST /api/arena/chat
openapi: 3.1.0
info:
  title: DualMind Arena API
  version: 1.0.0
  description: >-
    The REST API behind DualMind Arena: blind battles, votes, the leaderboard,
    models and threads.
  contact:
    name: DualMind Labs
    email: support@dualmindlab.tech
    url: https://dualmindlab.tech
servers:
  - url: https://api.dualmindlab.tech
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Arena
    description: Battles and chat.
  - name: Voting
    description: Votes and the leaderboard.
  - name: Models
    description: Available models.
  - name: Threads
    description: Saved conversations and sharing.
  - name: Utilities
    description: Health and feature flags.
paths:
  /api/arena/chat:
    post:
      tags:
        - Arena
      summary: Chat with one model
      description: >-
        Direct Chat: send a prompt to one model (or `auto` for a random one) and
        get the full reply.
      operationId: chat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatRequest'
            example:
              prompt: Explain TCP vs UDP with a pizza analogy
              model: auto
      responses:
        '200':
          description: The model's reply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatResponse'
              example:
                object: ai.response
                output:
                  type: message
                  content:
                    - type: output_text
                      text: Packets are pizzas...
                success: true
                message: Packets are pizzas...
                model:
                  name: llama-3.3-70b-versatile
                  displayName: Llama 3.3 70B Versatile
                  provider: groq
                prompt: Explain TCP vs UDP with a pizza analogy
                selectionMode: automatic
                responseTimeMs: 2140
                usage:
                  promptTokens: 18
                  completionTokens: 212
                  totalTokens: 230
                timestamp: '2026-10-17T12:00:00Z'
        '400':
          description: Missing prompt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiError'
      security:
        - bearerAuth: []
components:
  schemas:
    ChatRequest:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: The user prompt. Must not be empty.
          example: Explain TCP vs UDP with a pizza analogy
        model:
          type: string
          default: auto
          description: >-
            Model to use: a `modelName` (or `modelId`) from `GET /api/models`,
            or `auto` to let the Arena pick a random model.
          example: auto
        system:
          type: string
          description: Optional system prompt.
        maxTokens:
          type: integer
          minimum: 1
          default: 4096
          description: Maximum tokens to generate.
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 0.7
          description: Sampling temperature.
        threadId:
          type: string
          format: uuid
          description: Save the prompt and reply to this thread. You must own the thread.
    ChatResponse:
      type: object
      properties:
        object:
          type: string
          const: ai.response
        success:
          type: boolean
        message:
          type: string
          description: The model's reply as plain text (Markdown).
        output:
          type: object
          description: The same reply in a structured content envelope.
          properties:
            type:
              type: string
              const: message
            content:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    const: output_text
                  text:
                    type: string
        model:
          $ref: '#/components/schemas/ModelInfo'
        prompt:
          type: string
        selectionMode:
          type: string
          enum:
            - automatic
            - manual
            - random
            - topper
          description: >-
            `automatic`/`manual` for single chat; `random`/`topper`/`manual` for
            battles.
        responseTimeMs:
          type: integer
          description: >-
            Wall-clock time of the request in milliseconds. In a battle both
            models run in parallel, so this is the time until both finished.
        usage:
          $ref: '#/components/schemas/Usage'
        timestamp:
          type: string
          format: date-time
    AiError:
      type: object
      description: >-
        Error envelope used by the chat endpoints (and as an SSE event on the
        stream).
      properties:
        object:
          type: string
          const: ai.error
        code:
          type: string
          enum:
            - INVALID_REQUEST
            - API_ERROR
            - STREAM_ERROR
        message:
          type: string
        timestamp:
          type: string
          format: date-time
    ModelInfo:
      type: object
      properties:
        name:
          type: string
          description: >-
            Provider model name, e.g. `llama-3.3-70b-versatile` or
            `@cf/meta/llama-3.1-8b-instruct`.
        displayName:
          type: string
          description: Human-friendly name.
        provider:
          type: string
          enum:
            - groq
            - google
            - cloudflare
          description: Inference provider.
    Usage:
      type: object
      properties:
        promptTokens:
          type: integer
        completionTokens:
          type: integer
        totalTokens:
          type: integer
  responses:
    Unauthorized:
      description: >-
        Missing, invalid or expired token. The body is empty; the
        `WWW-Authenticate` header explains why.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        The access token from your DualMind Arena session (a Supabase JWT). See
        Authentication.

````

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