{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/memtro-com/json-schema/memtro-com-chat-request-schema.json",
  "title": "ChatRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/memtro-com-api-openapi.yml#/components/schemas/ChatRequest",
  "type": "object",
  "required": [
    "messages"
  ],
  "properties": {
    "model": {
      "type": "string",
      "default": "memtro",
      "description": "`auto`, `auto/<provider>`, `memtro`, `provider/model`, `claude-code/<alias>`, `compat:<label>/<model>`; append `:agent` or `:chat` to force a mode"
    },
    "messages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Message"
      }
    },
    "stream": {
      "type": "boolean"
    },
    "stream_options": {
      "type": "object",
      "properties": {
        "include_usage": {
          "type": "boolean"
        }
      }
    },
    "temperature": {
      "type": "number"
    },
    "top_p": {
      "type": "number"
    },
    "max_tokens": {
      "type": "integer"
    },
    "max_completion_tokens": {
      "type": "integer"
    },
    "stop": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "tools": {
      "type": "array",
      "description": "Client-declared tools (OpenAI function format); returned as tool_calls for you to execute. Not available with claude-code/* models.",
      "items": {
        "type": "object"
      }
    },
    "tool_choice": {},
    "memtro": {
      "$ref": "#/$defs/MemtroOptions"
    }
  },
  "$defs": {
    "MemtroOptions": {
      "type": "object",
      "description": "Memtro-specific options. `brain` is accepted as an older name for this field.",
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "chat",
            "agent"
          ],
          "description": "agent runs the multi-step harness; default chat or the organisation's setting"
        },
        "memory": {
          "type": "string",
          "enum": [
            "org",
            "personal",
            false
          ],
          "description": "Where facts learned from this exchange are stored; a ceiling, since personal facts are classified as such within org requests"
        },
        "retrieve": {
          "type": "boolean",
          "default": true,
          "description": "Inject relevant memories and graph context"
        },
        "tools": {
          "type": "boolean",
          "default": true,
          "description": "Expose memory and connector tools to the model"
        },
        "show_progress": {
          "type": "boolean",
          "default": true,
          "description": "Stream tool activity as reasoning_content in agent mode"
        },
        "engine": {
          "type": "string",
          "enum": [
            "native",
            "opencode",
            "claude-code"
          ],
          "description": "Which harness runs agent mode"
        },
        "cache": {
          "type": "boolean",
          "default": true,
          "description": "Serve identical connector calls from the short-lived cache"
        }
      }
    },
    "Message": {
      "type": "object",
      "required": [
        "role"
      ],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "system",
            "developer",
            "user",
            "assistant",
            "tool"
          ]
        },
        "content": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "image_url"
                    ]
                  },
                  "text": {
                    "type": "string"
                  },
                  "image_url": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          ]
        },
        "name": {
          "type": "string"
        },
        "tool_call_id": {
          "type": "string"
        }
      }
    }
  }
}