> ## Documentation Index
> Fetch the complete documentation index at: https://memos-api.openmem.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat with MemOS (Complete Response)

> Chat with MemOS for a specific user. Returns complete response (non-streaming).

This endpoint uses the class-based ChatHandler.



## OpenAPI

````yaml mintdocs/openapi.json post /product/chat/complete
openapi: 3.1.0
info:
  title: MemOS API
  version: 1.0.0
servers: []
security: []
paths:
  /product/chat/complete:
    post:
      tags:
        - Server API
      summary: Chat with MemOS (Complete Response)
      description: >-
        Chat with MemOS for a specific user. Returns complete response
        (non-streaming).


        This endpoint uses the class-based ChatHandler.
      operationId: chat_complete_product_chat_complete_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIChatCompleteRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    APIChatCompleteRequest:
      properties:
        user_id:
          type: string
          title: User Id
          description: User ID
        query:
          type: string
          title: Query
          description: Chat query message
        readable_cube_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Readable Cube Ids
          description: List of cube IDs user can read for multi-cube chat
        writable_cube_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Writable Cube Ids
          description: List of cube IDs user can write for multi-cube chat
        history:
          anyOf:
            - items:
                anyOf:
                  - $ref: '#/components/schemas/ChatCompletionSystemMessageParam'
                  - $ref: '#/components/schemas/ChatCompletionUserMessageParam'
                  - $ref: '#/components/schemas/ChatCompletionAssistantMessageParam'
                  - $ref: '#/components/schemas/ChatCompletionToolMessageParam'
              type: array
            - type: 'null'
          title: History
          description: Chat history
        mode:
          $ref: '#/components/schemas/SearchMode'
          description: 'search mode: fast, fine, or mixture'
          default: fast
        system_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: System Prompt
          description: Base system prompt to use for chat
        top_k:
          type: integer
          title: Top K
          description: Number of results to return
          default: 10
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
          description: Session ID for soft-filtering memories
        include_preference:
          type: boolean
          title: Include Preference
          description: Whether to handle preference memory
          default: true
        pref_top_k:
          type: integer
          title: Pref Top K
          description: Number of preference results to return
          default: 6
        model_name_or_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Name Or Path
          description: Model name to use for chat
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
          description: Max tokens to generate
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
          description: Temperature for sampling
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Top P
          description: Top-p (nucleus) sampling parameter
        add_message_on_answer:
          type: boolean
          title: Add Message On Answer
          description: Add dialogs to memory after chat
          default: true
        filter:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Filter
          description: |2-

                    Filter for the memory, example:
                    {
                        "`and` or `or`": [
                            {"id": "uuid-xxx"},
                            {"created_at": {"gt": "2024-01-01"}},
                        ]
                    }
                    
        internet_search:
          type: boolean
          title: Internet Search
          description: Whether to use internet search
          default: false
        threshold:
          type: number
          title: Threshold
          description: Threshold for filtering references
          default: 0.5
        mem_cube_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Mem Cube Id
          description: Cube ID to use for chat
        moscube:
          type: boolean
          title: Moscube
          description: (Deprecated) Whether to use legacy MemOSCube pipeline
          default: false
      type: object
      required:
        - user_id
        - query
      title: APIChatCompleteRequest
      description: Request model for chat operations.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatCompletionSystemMessageParam:
      properties:
        content:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
              type: array
            - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
          title: Content
        role:
          type: string
          const: system
          title: Role
        name:
          type: string
          title: Name
        chat_time:
          anyOf:
            - type: string
            - type: 'null'
          title: Chat Time
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
      type: object
      required:
        - content
        - role
      title: ChatCompletionSystemMessageParam
    ChatCompletionUserMessageParam:
      properties:
        content:
          anyOf:
            - type: string
            - items:
                anyOf:
                  - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
                  - $ref: '#/components/schemas/ChatCompletionContentPartImageParam'
                  - $ref: >-
                      #/components/schemas/ChatCompletionContentPartInputAudioParam
                  - $ref: '#/components/schemas/File'
              type: array
            - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
            - $ref: '#/components/schemas/ChatCompletionContentPartImageParam'
            - $ref: '#/components/schemas/ChatCompletionContentPartInputAudioParam'
            - $ref: '#/components/schemas/File'
          title: Content
        role:
          type: string
          const: user
          title: Role
        name:
          type: string
          title: Name
        chat_time:
          anyOf:
            - type: string
            - type: 'null'
          title: Chat Time
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
      type: object
      required:
        - content
        - role
      title: ChatCompletionUserMessageParam
    ChatCompletionAssistantMessageParam:
      properties:
        role:
          type: string
          const: assistant
          title: Role
        audio:
          anyOf:
            - $ref: '#/components/schemas/Audio'
            - type: 'null'
        content:
          anyOf:
            - type: string
            - items:
                anyOf:
                  - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
                  - $ref: '#/components/schemas/ChatCompletionContentPartRefusalParam'
              type: array
            - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
            - $ref: '#/components/schemas/ChatCompletionContentPartRefusalParam'
            - type: 'null'
          title: Content
        refusal:
          anyOf:
            - type: string
            - type: 'null'
          title: Refusal
        tool_calls:
          anyOf:
            - items:
                anyOf:
                  - $ref: >-
                      #/components/schemas/ChatCompletionMessageFunctionToolCallParam
                  - $ref: >-
                      #/components/schemas/ChatCompletionMessageCustomToolCallParam
              type: array
            - $ref: '#/components/schemas/ChatCompletionMessageFunctionToolCallParam'
            - $ref: '#/components/schemas/ChatCompletionMessageCustomToolCallParam'
          title: Tool Calls
        chat_time:
          anyOf:
            - type: string
            - type: 'null'
          title: Chat Time
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
      type: object
      required:
        - role
      title: ChatCompletionAssistantMessageParam
    ChatCompletionToolMessageParam:
      properties:
        content:
          anyOf:
            - type: string
            - items:
                anyOf:
                  - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
                  - $ref: '#/components/schemas/ChatCompletionContentPartImageParam'
                  - $ref: >-
                      #/components/schemas/ChatCompletionContentPartInputAudioParam
                  - $ref: '#/components/schemas/File'
              type: array
            - $ref: '#/components/schemas/ChatCompletionContentPartTextParam'
            - $ref: '#/components/schemas/ChatCompletionContentPartImageParam'
            - $ref: '#/components/schemas/ChatCompletionContentPartInputAudioParam'
            - $ref: '#/components/schemas/File'
          title: Content
        role:
          type: string
          const: tool
          title: Role
        tool_call_id:
          type: string
          title: Tool Call Id
        chat_time:
          anyOf:
            - type: string
            - type: 'null'
          title: Chat Time
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
      type: object
      required:
        - content
        - role
        - tool_call_id
      title: ChatCompletionToolMessageParam
    SearchMode:
      type: string
      enum:
        - fast
        - fine
        - mixture
      title: SearchMode
      description: Enumeration for search modes.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ChatCompletionContentPartTextParam:
      properties:
        text:
          type: string
          title: Text
        type:
          type: string
          const: text
          title: Type
      type: object
      required:
        - text
        - type
      title: ChatCompletionContentPartTextParam
    ChatCompletionContentPartImageParam:
      properties:
        image_url:
          $ref: '#/components/schemas/ImageURL'
        type:
          type: string
          const: image_url
          title: Type
      type: object
      required:
        - image_url
        - type
      title: ChatCompletionContentPartImageParam
    ChatCompletionContentPartInputAudioParam:
      properties:
        input_audio:
          $ref: '#/components/schemas/InputAudio'
        type:
          type: string
          const: input_audio
          title: Type
      type: object
      required:
        - input_audio
        - type
      title: ChatCompletionContentPartInputAudioParam
    File:
      properties:
        file:
          $ref: '#/components/schemas/FileFile'
        type:
          type: string
          const: file
          title: Type
      type: object
      required:
        - file
        - type
      title: File
    Audio:
      properties:
        id:
          type: string
          title: Id
      type: object
      required:
        - id
      title: Audio
    ChatCompletionContentPartRefusalParam:
      properties:
        refusal:
          type: string
          title: Refusal
        type:
          type: string
          const: refusal
          title: Type
      type: object
      required:
        - refusal
        - type
      title: ChatCompletionContentPartRefusalParam
    ChatCompletionMessageFunctionToolCallParam:
      properties:
        id:
          type: string
          title: Id
        function:
          $ref: '#/components/schemas/Function'
        type:
          type: string
          const: function
          title: Type
      type: object
      required:
        - id
        - function
        - type
      title: ChatCompletionMessageFunctionToolCallParam
    ChatCompletionMessageCustomToolCallParam:
      properties:
        id:
          type: string
          title: Id
        custom:
          $ref: '#/components/schemas/Custom'
        type:
          type: string
          const: custom
          title: Type
      type: object
      required:
        - id
        - custom
        - type
      title: ChatCompletionMessageCustomToolCallParam
    ImageURL:
      properties:
        url:
          type: string
          title: Url
        detail:
          type: string
          enum:
            - auto
            - low
            - high
          title: Detail
      type: object
      required:
        - url
      title: ImageURL
    InputAudio:
      properties:
        data:
          type: string
          title: Data
        format:
          type: string
          enum:
            - wav
            - mp3
          title: Format
      type: object
      required:
        - data
        - format
      title: InputAudio
    FileFile:
      properties:
        file_data:
          type: string
          title: File Data
        file_id:
          type: string
          title: File Id
        filename:
          type: string
          title: Filename
      type: object
      title: FileFile
    Function:
      properties:
        arguments:
          type: string
          title: Arguments
        name:
          type: string
          title: Name
      type: object
      required:
        - arguments
        - name
      title: Function
    Custom:
      properties:
        input:
          type: string
          title: Input
        name:
          type: string
          title: Name
      type: object
      required:
        - input
        - name
      title: Custom

````