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

# Chat completions (OpenAI-compatible)

> LLM-style compatibility route. Use only when you explicitly want the chat pipeline; the /api/v1/memory/* and /memz/* routes are the non-LLM memory/reasoning path. `session_id` is overwritten by the proxy with the agent ID.



## OpenAPI

````yaml /neuroadapt-openapi.json post /v1/chat/completions
openapi: 3.0.3
info:
  title: Neuroadapt API
  version: 1.0.0
  description: >-
    Neuroadapt is a local, non-LLM memory and reasoning API exposed through an
    authenticating go-proxy. It stores session-scoped events, retrieves relevant
    evidence, exposes concept-level reasoning signals, and keeps enough state
    for frontend clients to inspect what the system knows.


    ## Authentication


    Send `Authorization: Bearer <secretToken>`. The proxy looks the token up in
    the MongoDB `agents` collection and **forces `session_id = agentId` on every
    request**. Any `session_id` you put in the body (or in the
    `/memz/memories/{session_id}` path) is overwritten by the proxy, so the
    value you send is a placeholder. A missing or invalid token returns `401`.


    The core memory endpoints do not call an LLM; the OpenAI-compatible chat
    route is present only for compatibility.


    ## API prefix


    The versioned API is served under `/api/v1`. Equivalent bowtie-compatible
    prefixes are also available: `/public/rei-ai-bowtie/v4` and
    `/rei-ai-bowtie/v4`.
servers:
  - url: https://rei-neuroadapt-api.reilabs.org
    description: UAT (proxied, authenticated)
security:
  - BearerAuth: []
tags:
  - name: System
    description: >-
      Health and version checks. Public — no auth required (passed through by
      the proxy).
  - name: Memory
    description: Session-scoped, non-LLM memory and reasoning endpoints (/api/v1/memory/*).
  - name: Domains
    description: >-
      Closed-source expansion surface. Declare schemas, rules, events, queries,
      and feedback over HTTP (/api/v1/domains/*).
  - name: Legacy
    description: Low-level memory API (/memz/*).
  - name: Chat
    description: >-
      OpenAI-compatible chat completion route. Use only when you explicitly want
      the chat pipeline.
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat
      summary: Chat completions (OpenAI-compatible)
      description: >-
        LLM-style compatibility route. Use only when you explicitly want the
        chat pipeline; the /api/v1/memory/* and /memz/* routes are the non-LLM
        memory/reasoning path. `session_id` is overwritten by the proxy with the
        agent ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - messages
              properties:
                messages:
                  type: array
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                          - tool
                      content:
                        type: string
                session_id:
                  type: string
                  description: Placeholder — overwritten by the proxy.
                top_k:
                  type: integer
                  default: 5
                metadata_filter:
                  type: object
                  additionalProperties: true
                  nullable: true
                model:
                  type: string
                  nullable: true
            example:
              messages:
                - role: user
                  content: What do you know about Alice?
              session_id: ignored
              top_k: 5
              metadata_filter: null
              model: null
      responses:
        '200':
          description: Chat completion result.
          content:
            application/json:
              schema:
                type: object
              example:
                id: chatcmpl-uuid
                object: chat.completion
                created: 1782200000
                model: neuroadapt
                choices:
                  - index: 0
                    finish_reason: stop
                    message:
                      role: assistant
                      content: ...
                usage:
                  prompt_tokens: 0
                  completion_tokens: 0
                  total_tokens: 0
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            type: object
          example:
            detail: Unauthorized
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Unit API Key mapped to an agent in the `agents` collection. The proxy
        forces `session_id = agentId`.

````