chats
Classes
ChatModel
Bases: BaseModel
Represents a chat conversation in the Open WebUI system.
This model stores the core chat data including the conversation history, metadata, and status flags like archived or pinned.
- Code Reference models chats Classes ChatListResponse Attributes items
Attributes
chat
The full chat content and history.
Contains the messages, model configuration, and other conversation state. This dictionary represents the complete chat structure used throughout the Open WebUI system.
Dict Fields
title(str, optional): The title of the chat conversationname(str, optional): Alternative name for the chatdescription(str, optional): Description of the chattags(list[str], optional): List of tag names associated with this chathistory(dict, required): Contains the conversation history with:currentId(str, required): ID of the current message in the conversationmessages(dict[str, object], required): Map of message IDs to message objects
models(list[str], optional): List of model IDs used in this chatparams(dict, optional): Model parameters and configurationoptions(dict, optional): Additional chat options and settingstimestamp(int, optional): Creation timestamp (Unix epoch)originalChatId(str, optional): ID of the original chat if this is a clonebranchPointMessageId(str, optional): Message ID where branching occurred for cloned chats
The chat dictionary is the core data structure that stores all conversation state,
message history, and metadata. It's used for creating, updating, and managing chats.
share_id
ID of the shared version of this chat, if shared.
If set, this points to a separate read-only copy of the chat accessible via sharing.
meta
Additional metadata for the chat.
The meta dictionary stores various metadata about the chat, primarily used for organizational and filtering purposes. This field is used extensively throughout the Open WebUI system for tagging, searching, and managing chats.
Dict Fields
tags(list[str], optional): List of tag identifiers associated with this chat for categorization and filtering. Tags are used throughout the system for organizing chats and enabling tag-based search functionality. When chats are archived, tags may be automatically cleaned up if no other chats use them. Tag names are normalized to lowercase with spaces replaced by underscores (e.g., "my tag" becomes "my_tag").
The meta field is preserved when chats are cloned, shared, or imported, maintaining the organizational structure. It plays a crucial role in the chat management system, particularly in tag-based operations.
ChatForm
Bases: BaseModel
Form for creating or updating a chat.
- Code Reference models chats Classes ChatImportForm
- Code Reference routers chats Classes ChatsClient Functions
Attributes
chat
The chat content.
Contains the full conversation state including messages, metadata, and configuration. This dictionary represents the complete chat structure used throughout the Open WebUI system.
Dict Fields
title(str, optional): The title of the chat conversationname(str, optional): Alternative name for the chatdescription(str, optional): Description of the chattags(list[str], optional): List of tag names associated with this chathistory(dict, required): Contains the conversation history with:currentId(str, required): ID of the current message in the conversationmessages(dict[str, object], required): Map of message IDs to message objects
models(list[str], optional): List of model IDs used in this chatparams(dict, optional): Model parameters and configurationoptions(dict, optional): Additional chat options and settingstimestamp(int, optional): Creation timestamp (Unix epoch)originalChatId(str, optional): ID of the original chat if this is a clonebranchPointMessageId(str, optional): Message ID where branching occurred for cloned chats
The chat dictionary is the core data structure that stores all conversation state,
message history, and metadata. It's used for creating, updating, and managing chats.
ChatImportForm
Bases: ChatForm
Form for importing a chat, including metadata and timestamps.
This form extends ChatForm to include additional metadata and timestamps
for chat import operations. The chat attribute contains the complete
conversation state including messages, metadata, and configuration.
- Code Reference models chats Classes ChatsImportForm Attributes chats
Attributes
meta
Metadata for the chat import operation.
Dict Fields
tags(list[str], optional): List of tag names associated with this chat for categorization and filtering
The meta dictionary stores additional metadata about the chat, primarily used for organizational purposes. The most common and well-documented key is 'tags', which allows chats to be categorized and filtered.
ChatsImportForm
Bases: BaseModel
Form for importing multiple chats at once.
- Code Reference routers chats Classes ChatsClient Functions import_chats
Attributes
ChatTitleMessagesForm
Bases: BaseModel
Form containing a title and messages, used for utility operations like PDF generation.
- Code Reference routers utils Classes UtilsClient Functions download_chat_as_pdf
Attributes
messages
List of message objects from the chat history.
Dict Fields
role(str, required): The role of the message sender, typically 'user' or 'assistant'content(str, required): The text content of the messagetimestamp(float, optional): UNIX timestamp (seconds since epoch) when the message was createdmodel(str, optional): The model identifier used for generating assistant messages (e.g., 'gpt-4', 'claude-3')
This list contains the complete conversation history in chronological order, used for PDF generation and other export operations. Each message represents one turn in the conversation between user and assistant.
ChatTitleForm
ChatResponse
Bases: BaseModel
Response model for chat operations.
Attributes
chat
The full chat content and history.
Contains the messages, model configuration, and other conversation state. This dictionary represents the complete chat structure used throughout the Open WebUI system.
Dict Fields
title(str, optional): The title of the chat conversationname(str, optional): Alternative name for the chatdescription(str, optional): Description of the chattags(list[str], optional): List of tag names associated with this chathistory(dict, required): Contains the conversation history with:currentId(str, required): ID of the current message in the conversationmessages(dict[str, object], required): Map of message IDs to message objects
models(list[str], optional): List of model IDs used in this chatparams(dict, optional): Model parameters and configurationoptions(dict, optional): Additional chat options and settingstimestamp(int, optional): Creation timestamp (Unix epoch)originalChatId(str, optional): ID of the original chat if this is a clonebranchPointMessageId(str, optional): Message ID where branching occurred for cloned chats
The chat dictionary is the core data structure that stores all conversation state,
message history, and metadata. It's used for creating, updating, and managing chats.
meta
Additional metadata for the chat.
The meta dictionary stores various metadata about the chat, primarily used for organizational and filtering purposes. This field is used extensively throughout the Open WebUI system for tagging, searching, and managing chats.
Dict Fields
tags(list[str], optional): List of tag identifiers associated with this chat for categorization and filtering. Tags are used throughout the system for organizing chats and enabling tag-based search functionality. When chats are archived, tags may be automatically cleaned up if no other chats use them. Tag names are normalized to lowercase with spaces replaced by underscores (e.g., "my tag" becomes "my_tag").
The meta field is preserved when chats are cloned, shared, or imported, maintaining the organizational structure. It plays a crucial role in the chat management system, particularly in tag-based operations.
ChatListResponse
Bases: BaseModel
Response model for a list of chats with pagination.
ChatUsageStatsResponse
Bases: BaseModel
Response model for chat usage statistics.
- Code Reference models chats Classes ChatUsageStatsListResponse Attributes items
Attributes
models
Models used in the chat with their usage counts.
Dict Fields
key(str): The model ID.value(int): The usage count for that model.
history_models
Models used in the chat history with their usage counts.
Dict Fields
key(str): The model ID.value(int): The usage count for that model.
history_user_message_count
Number of user messages in the chat history.
history_assistant_message_count
Number of assistant messages in the chat history.
average_response_time
Average response time of assistant messages in seconds.
average_user_message_content_length
Average length of user message contents.
average_assistant_message_content_length
Average length of assistant message contents.
ChatUsageStatsListResponse
Bases: BaseModel
Response model for a list of chat usage statistics with pagination.
- Code Reference routers chats Classes ChatsClient Functions get_chat_usage_stats
Attributes
ChatTitleIdResponse
Bases: BaseModel
Lightweight chat response containing only essential metadata.
Used for list views to reduce payload size.
- Code Reference routers chats Classes ChatsClient Functions
TagForm
Bases: BaseModel
Form for adding a tag to a chat.
- Code Reference models chats Classes TagFilterForm
- Code Reference routers chats Classes ChatsClient Functions
TagFilterForm
Bases: TagForm
Form for filtering chats by tag.
- Code Reference routers chats Classes ChatsClient Functions get_by_tags
MessageForm
Bases: BaseModel
Form for updating a specific message content.
- Code Reference routers chats Classes ChatsClient Functions update_message
EventForm
Bases: BaseModel
Form for sending an event related to a specific message.
Used to trigger socket events for a message.
- Code Reference routers chats Classes ChatsClient Functions send_message_event
Attributes
data
The data payload for the event.
Contains event-specific data that varies based on the event type. This dictionary holds the actual content and metadata for the event being triggered.
Dict Fields
content(str, optional): Text content for message-related events (used in 'message' and 'replace' event types)embeds(list, optional): List of embed objects for embed-related eventsfiles(list, optional): List of file objects for file-related eventsstatus(dict, optional): Status information for status-related eventstype(str, optional): Additional type specification for certain event typessource(dict, optional): Source information for source/citation eventscitation(dict, optional): Citation information for source/citation events
The data structure is event-type specific:
- For 'message' events: contains content field with additional message text
- For 'replace' events: contains content field with replacement message text
- For 'embeds' events: contains embeds field with list of embed objects
- For 'files' events: contains files field with list of file objects
- For 'status' events: contains status information in the data object
- For 'source'/'citation' events: contains source/citation data with optional type field
Event types discovered in backend code: - 'status': Updates message status information - 'message': Appends content to existing messages - 'replace': Replaces entire message content - 'embeds': Adds embed objects to messages - 'files': Adds file objects to messages - 'source'/'citation': Handles source and citation data
The data field is passed through the event emission system and processed based on the event type.
CloneForm
Bases: BaseModel
Form for cloning a chat.
- Code Reference routers chats Classes ChatsClient Functions clone
ChatFolderIdForm
Bases: BaseModel
Form for moving a chat to a folder.
- Code Reference routers chats Classes ChatsClient Functions update_folder
MessageStats
Bases: BaseModel
Statistics for a single message.
- Code Reference models chats Classes ChatHistoryStats Attributes messages
Attributes
ChatHistoryStats
Bases: BaseModel
Statistics for chat history.
- Code Reference models chats Classes ChatBody Attributes history
Attributes
messages
messages: dict[str, MessageStats]
Map of message IDs to message statistics.
Dict Fields
key(str): Message IDvalue(MessageStats): Statistics for the message
ChatBody
Bases: BaseModel
Body of a chat with history statistics.
- Code Reference models chats Classes ChatStatsExport Attributes chat
Attributes
AggregateChatStats
Bases: BaseModel
Aggregated statistics for a chat session.
Includes metrics such as average response time, message length, and model usage counts.
- Code Reference models chats Classes ChatStatsExport Attributes stats
Attributes
average_response_time
Average response time of assistant messages in seconds.
average_user_message_content_length
Average length of user message contents.
average_assistant_message_content_length
Average length of assistant message contents.
models
Counts of models used in the current message path.
Dict Fields
key(str): Model IDvalue(int): Usage count
history_models
Counts of models used in the entire history.
Dict Fields
key(str): Model IDvalue(int): Usage count
history_user_message_count
Total number of user messages in the history.
ChatStatsExport
Bases: BaseModel
Export model for chat statistics.
- Code Reference
Attributes
ChatStatsExportList
Bases: BaseModel
List of exported chat statistics.
- Code Reference routers chats Classes ChatsClient Functions export_chat_stats
Attributes
ChatCompletionForm
Bases: BaseModel
Request form for chat completion generation.
This model accepts OpenAI-compatible chat completion parameters along with
Open WebUI-specific metadata for chat management, file attachments, tools, and more.
Uses extra="allow" to pass through any additional OpenAI API parameters.
- Code Reference routers chats Classes ChatsClient Functions
Attributes
messages
List of message objects representing the conversation history.
Dict Fields
role(str, required): The role of the message sender. Valid values: "system", "user", "assistant", "tool"content(str or list, required): The message content. Can be a string or a list of content blocks (for multimodal)name(str, optional): Name of the participant (for role-based naming)tool_calls(list, optional): List of tool calls made by the assistanttool_call_id(str, optional): ID of the tool call being responded to (for tool role)
chat_id
Optional chat ID to associate this completion with an existing chat.
parent_message
Optional parent message object for threading.
Dict Fields
id(str, required): The parent message IDrole(str, required): The parent message rolecontent(str, required): The parent message content- Additional message metadata fields
session_id
Optional session ID for async processing. When provided, returns a task_id instead of the completion.
filter_ids
Optional list of filter IDs to apply for retrieval-augmented generation.
tool_ids
Optional list of tool IDs to make available to the model.
tool_servers
Optional tool server configurations.
Dict Fields
- Server-specific configuration for MCP (Model Context Protocol) tools
- Connection details and authentication for external tool servers
files
Optional list of file attachments for multimodal inputs.
Dict Fields
id(str, required): File IDtype(str, required): File type (e.g., "file", "image")name(str, optional): File name- Additional file metadata
features
Optional feature flags and configurations.
Dict Fields
- Feature-specific settings for enabling/disabling capabilities
- Experimental feature flags
variables
Optional template variables for prompt templating.
Dict Fields
- Variable name to value mappings
- Used for substituting placeholders in system prompts or templates
params
Optional model parameters and generation settings.
Dict Fields
stream_delta_chunk_size(int, optional): Chunk size for streaming responsesreasoning_tags(str, optional): Tags for reasoning outputfunction_calling(str, optional): Function calling mode. Valid values: "native", "default"
model_item
Optional direct model configuration for bypassing model registry.
Dict Fields
direct(bool, required): Must be True to use direct model configuration- Model-specific configuration fields (base_url, api_key, etc.)
background_tasks
Optional background tasks to execute after completion.
ChatCompletionResponse
Bases: BaseModel
Response model for chat completion.
The response format varies based on whether the request was processed synchronously or asynchronously (when session_id is provided).
- Code Reference routers chats Classes ChatsClient Functions
ChatCompletedForm
Bases: BaseModel
Form for notifying that a chat completion has been generated.
This endpoint is called after a chat completion is generated to process outlet filters that may modify the response. The form contains the completed message and associated metadata.
- Code Reference routers chats Classes ChatsClient Functions
Attributes
ChatCompletedResponse
Bases: BaseModel
Response model for chat completed endpoint.
Returns the modified form data after processing outlet filters. The structure matches the request form but may be modified by filters.
- Code Reference routers chats Classes ChatsClient Functions
ChatActionForm
Bases: BaseModel
Form for executing a chat action.
This form is used to trigger custom actions (functions) that can process chat messages and return results. Actions are user-defined functions that can perform arbitrary operations on chat data.
- Code Reference routers chats Classes ChatsClient Functions chat_action
Attributes
ChatActionResponse
Bases: BaseModel
Response model for chat action endpoint.
The response structure varies based on the action function being executed. Actions can return any data type, so this model uses extra="allow" to accommodate arbitrary response structures.
- Code Reference routers chats Classes ChatsClient Functions chat_action