openapi.json•39 kB
{
"openapi": "3.1.0",
"info": {
"title": "MemOS REST APIs",
"description": "A REST API for managing and searching memories using MemOS.",
"version": "1.0.0"
},
"paths": {
"/configure": {
"post": {
"summary": "Configure MemOS",
"description": "Set MemOS configuration.",
"operationId": "set_config_configure_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MOSConfig"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConfigResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/users": {
"get": {
"summary": "List all users",
"description": "List all active users.",
"operationId": "list_users_users_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserListResponse"
}
}
}
}
}
},
"post": {
"summary": "Create a new user",
"description": "Create a new user.",
"operationId": "create_user_users_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserCreate"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/users/me": {
"get": {
"summary": "Get current user info",
"description": "Get current user information including accessible cubes.",
"operationId": "get_user_info_users_me_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponse"
}
}
}
}
}
}
},
"/mem_cubes": {
"post": {
"summary": "Register a MemCube",
"description": "Register a new MemCube.",
"operationId": "register_mem_cube_mem_cubes_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemCubeRegister"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/mem_cubes/{mem_cube_id}": {
"delete": {
"summary": "Unregister a MemCube",
"description": "Unregister a MemCube.",
"operationId": "unregister_mem_cube_mem_cubes__mem_cube_id__delete",
"parameters": [
{
"name": "mem_cube_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Mem Cube Id"
}
},
{
"name": "user_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/mem_cubes/{cube_id}/share": {
"post": {
"summary": "Share a cube with another user",
"description": "Share a cube with another user.",
"operationId": "share_cube_mem_cubes__cube_id__share_post",
"parameters": [
{
"name": "cube_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Cube Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CubeShare"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/memories": {
"post": {
"summary": "Create memories",
"description": "Store new memories in a MemCube.",
"operationId": "add_memory_memories_post",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemoryCreate"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"get": {
"summary": "Get all memories",
"description": "Retrieve all memories from a MemCube.",
"operationId": "get_all_memories_memories_get",
"parameters": [
{
"name": "mem_cube_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Mem Cube Id"
}
},
{
"name": "user_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemoryResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/memories/{mem_cube_id}/{memory_id}": {
"get": {
"summary": "Get a memory",
"description": "Retrieve a specific memory by ID from a MemCube.",
"operationId": "get_memory_memories__mem_cube_id___memory_id__get",
"parameters": [
{
"name": "mem_cube_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Mem Cube Id"
}
},
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Memory Id"
}
},
{
"name": "user_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MemoryResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"put": {
"summary": "Update a memory",
"description": "Update an existing memory in a MemCube.",
"operationId": "update_memory_memories__mem_cube_id___memory_id__put",
"parameters": [
{
"name": "mem_cube_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Mem Cube Id"
}
},
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Memory Id"
}
},
{
"name": "user_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true,
"title": "Updated Memory"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"delete": {
"summary": "Delete a memory",
"description": "Delete a specific memory from a MemCube.",
"operationId": "delete_memory_memories__mem_cube_id___memory_id__delete",
"parameters": [
{
"name": "mem_cube_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Mem Cube Id"
}
},
{
"name": "memory_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Memory Id"
}
},
{
"name": "user_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/search": {
"post": {
"summary": "Search memories",
"description": "Search for memories across MemCubes.",
"operationId": "search_memories_search_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SearchRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SearchResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/memories/{mem_cube_id}": {
"delete": {
"summary": "Delete all memories",
"description": "Delete all memories from a MemCube.",
"operationId": "delete_all_memories_memories__mem_cube_id__delete",
"parameters": [
{
"name": "mem_cube_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Mem Cube Id"
}
},
{
"name": "user_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SimpleResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/chat": {
"post": {
"summary": "Chat with MemOS",
"description": "Chat with the MemOS system.",
"operationId": "chat_chat_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ChatRequest": {
"properties": {
"user_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id",
"description": "User ID for the request",
"example": "user123"
},
"query": {
"type": "string",
"title": "Query",
"description": "Chat query message.",
"example": "What is the latest update?"
}
},
"type": "object",
"required": [
"query"
],
"title": "ChatRequest"
},
"ChatResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "ChatResponse",
"description": "Response model for chat operations."
},
"ConfigResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"type": "null",
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "ConfigResponse",
"description": "Response model for configuration endpoint."
},
"CubeShare": {
"properties": {
"user_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id",
"description": "User ID for the request",
"example": "user123"
},
"target_user_id": {
"type": "string",
"title": "Target User Id",
"description": "Target user ID to share with",
"example": "user456"
}
},
"type": "object",
"required": [
"target_user_id"
],
"title": "CubeShare"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"LLMConfigFactory": {
"properties": {
"model_schema": {
"type": "string",
"title": "Model Schema",
"description": "Schema for configuration. This value will be automatically set.",
"default": "NOT_SET"
},
"backend": {
"type": "string",
"title": "Backend",
"description": "Backend for LLM"
},
"config": {
"additionalProperties": true,
"type": "object",
"title": "Config",
"description": "Configuration for the LLM backend"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"backend",
"config"
],
"title": "LLMConfigFactory",
"description": "Factory class for creating LLM configurations."
},
"MOSConfig": {
"properties": {
"model_schema": {
"type": "string",
"title": "Model Schema",
"description": "Schema for configuration. This value will be automatically set.",
"default": "NOT_SET"
},
"user_id": {
"type": "string",
"title": "User Id",
"description": "User ID for the MOS. This is used to distinguish between different users' memories.",
"default": "root"
},
"session_id": {
"type": "string",
"title": "Session Id",
"description": "Session ID for the MOS. This is used to distinguish between different dialogue",
"default": "3d88949f-cbe1-4244-a2e1-d346e8b76ca0"
},
"chat_model": {
"$ref": "#/components/schemas/LLMConfigFactory",
"description": "LLM configuration for the chat model in the MOS"
},
"mem_reader": {
"$ref": "#/components/schemas/MemReaderConfigFactory",
"description": "MemReader configuration for the MOS"
},
"mem_scheduler": {
"anyOf": [
{
"$ref": "#/components/schemas/SchedulerConfigFactory"
},
{
"type": "null"
}
],
"description": "Memory scheduler configuration for managing memory operations"
},
"max_turns_window": {
"type": "integer",
"title": "Max Turns Window",
"description": "Maximum number of turns to keep in the conversation history",
"default": 15
},
"top_k": {
"type": "integer",
"title": "Top K",
"description": "Maximum number of memories to retrieve for each query",
"default": 5
},
"enable_textual_memory": {
"type": "boolean",
"title": "Enable Textual Memory",
"description": "Enable textual memory for the MemChat",
"default": true
},
"enable_activation_memory": {
"type": "boolean",
"title": "Enable Activation Memory",
"description": "Enable activation memory for the MemChat",
"default": false
},
"enable_parametric_memory": {
"type": "boolean",
"title": "Enable Parametric Memory",
"description": "Enable parametric memory for the MemChat",
"default": false
},
"enable_mem_scheduler": {
"type": "boolean",
"title": "Enable Mem Scheduler",
"description": "Enable memory scheduler for automated memory management",
"default": false
},
"PRO_MODE": {
"type": "boolean",
"title": "Pro Mode",
"description": "Enable PRO mode for complex query decomposition",
"default": false
}
},
"additionalProperties": false,
"type": "object",
"title": "MOSConfig"
},
"MemCubeRegister": {
"properties": {
"user_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id",
"description": "User ID for the request",
"example": "user123"
},
"mem_cube_name_or_path": {
"type": "string",
"title": "Mem Cube Name Or Path",
"description": "Name or path of the MemCube to register.",
"example": "/path/to/cube"
},
"mem_cube_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Mem Cube Id",
"description": "ID for the MemCube",
"example": "cube123"
}
},
"type": "object",
"required": [
"mem_cube_name_or_path"
],
"title": "MemCubeRegister"
},
"MemReaderConfigFactory": {
"properties": {
"model_schema": {
"type": "string",
"title": "Model Schema",
"description": "Schema for configuration. This value will be automatically set.",
"default": "NOT_SET"
},
"backend": {
"type": "string",
"title": "Backend",
"description": "Backend for MemReader"
},
"config": {
"additionalProperties": true,
"type": "object",
"title": "Config",
"description": "Configuration for the MemReader backend"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"backend",
"config"
],
"title": "MemReaderConfigFactory",
"description": "Factory class for creating MemReader configurations."
},
"MemoryCreate": {
"properties": {
"user_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id",
"description": "User ID for the request",
"example": "user123"
},
"messages": {
"anyOf": [
{
"items": {
"$ref": "#/components/schemas/Message"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Messages",
"description": "List of messages to store.",
"example": [
{
"content": "Hello",
"role": "user"
}
]
},
"mem_cube_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Mem Cube Id",
"description": "ID of the memory cube",
"example": "cube123"
},
"memory_content": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Memory Content",
"description": "Content to store as memory",
"example": "This is a memory content"
},
"doc_path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Doc Path",
"description": "Path to document to store",
"example": "/path/to/document.txt"
}
},
"type": "object",
"title": "MemoryCreate"
},
"MemoryResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "MemoryResponse",
"description": "Response model for memory operations."
},
"Message": {
"properties": {
"role": {
"type": "string",
"title": "Role",
"description": "Role of the message (user or assistant).",
"example": "user"
},
"content": {
"type": "string",
"title": "Content",
"description": "Message content.",
"example": "Hello, how can I help you?"
}
},
"type": "object",
"required": [
"role",
"content"
],
"title": "Message"
},
"SchedulerConfigFactory": {
"properties": {
"model_schema": {
"type": "string",
"title": "Model Schema",
"description": "Schema for configuration. This value will be automatically set.",
"default": "NOT_SET"
},
"backend": {
"type": "string",
"title": "Backend",
"description": "Backend for scheduler"
},
"config": {
"additionalProperties": true,
"type": "object",
"title": "Config",
"description": "Configuration for the scheduler backend"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"backend",
"config"
],
"title": "SchedulerConfigFactory",
"description": "Factory class for creating scheduler configurations."
},
"SearchRequest": {
"properties": {
"user_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Id",
"description": "User ID for the request",
"example": "user123"
},
"query": {
"type": "string",
"title": "Query",
"description": "Search query.",
"example": "How to implement a feature?"
},
"install_cube_ids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Install Cube Ids",
"description": "List of cube IDs to search in",
"example": [
"cube123",
"cube456"
]
}
},
"type": "object",
"required": [
"query"
],
"title": "SearchRequest"
},
"SearchResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "SearchResponse",
"description": "Response model for search operations."
},
"SimpleResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"type": "null",
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "SimpleResponse",
"description": "Simple response model for operations without data return."
},
"UserCreate": {
"properties": {
"user_id": {
"type": "string",
"title": "User Id",
"description": "User ID",
"example": "user123"
},
"user_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "User Name",
"description": "Name of the user",
"example": "john_doe"
},
"role": {
"type": "string",
"title": "Role",
"description": "Role of the user",
"default": "user",
"example": "user"
}
},
"type": "object",
"required": [
"user_id"
],
"title": "UserCreate"
},
"UserListResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"anyOf": [
{
"items": {},
"type": "array"
},
{
"type": "null"
}
],
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "UserListResponse",
"description": "Response model for user list operations."
},
"UserResponse": {
"properties": {
"code": {
"type": "integer",
"title": "Code",
"description": "Response status code",
"default": 200,
"example": 200
},
"message": {
"type": "string",
"title": "Message",
"description": "Response message",
"example": "Operation successful"
},
"data": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Data",
"description": "Response data"
}
},
"type": "object",
"required": [
"message"
],
"title": "UserResponse",
"description": "Response model for user operations."
},
"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"
}
}
}
}