chats
Classes
ChatsClient
ChatsClient(client: OWUIClientBase)
Bases: ResourceBase
Client for the Chats endpoints.
Manages chat conversations, including creating, retrieving, updating, and deleting chats, as well as managing chat history, tags, and sharing.
- Code Reference client Classes OpenWebUI Attributes chats
Source code in src/owui_client/client_base.py
Functions
get_list
get_list(
page: Optional[int] = None,
include_pinned: Optional[bool] = False,
include_folders: Optional[bool] = False,
) -> List[ChatTitleIdResponse]
Get a list of chats for the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
Optional[int]
|
Page number for pagination. If None, returns all chats. |
None
|
include_pinned
|
Optional[bool]
|
Whether to include pinned chats in the response. |
False
|
include_folders
|
Optional[bool]
|
Whether to include chats that are inside folders. |
False
|
Returns:
| Type | Description |
|---|---|
List[ChatTitleIdResponse]
|
List of chat titles and IDs. |
Source code in src/owui_client/routers/chats.py
delete_all
Delete all chats for the current user.
Returns:
| Type | Description |
|---|---|
bool
|
True if successful. |
get_user_list
get_user_list(
user_id: str,
page: Optional[int] = None,
query: Optional[str] = None,
order_by: Optional[str] = None,
direction: Optional[str] = None,
) -> List[ChatTitleIdResponse]
Get a list of chats for a specific user (Admin only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
ID of the user to fetch chats for. |
required |
page
|
Optional[int]
|
Page number for pagination. |
None
|
query
|
Optional[str]
|
Search query for filtering chats. |
None
|
order_by
|
Optional[str]
|
Field to order by. |
None
|
direction
|
Optional[str]
|
Sort direction ('asc' or 'desc'). |
None
|
Returns:
| Type | Description |
|---|---|
List[ChatTitleIdResponse]
|
List of chat titles and IDs. |
Source code in src/owui_client/routers/chats.py
create_new
create_new(form_data: ChatForm) -> Optional[ChatResponse]
Create a new chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
ChatForm
|
The initial data for the chat. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The created chat object. |
Source code in src/owui_client/routers/chats.py
import_chats
import_chats(
form_data: ChatsImportForm,
) -> List[ChatResponse]
Import multiple chats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
ChatsImportForm
|
The list of chats to import. |
required |
Returns:
| Type | Description |
|---|---|
List[ChatResponse]
|
List of successfully imported chat objects. |
Source code in src/owui_client/routers/chats.py
search
search(
text: str, page: Optional[int] = None
) -> List[ChatTitleIdResponse]
Search for chats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The search query text. |
required |
page
|
Optional[int]
|
Page number for pagination. |
None
|
Returns:
| Type | Description |
|---|---|
List[ChatTitleIdResponse]
|
List of chats matching the search query. |
Source code in src/owui_client/routers/chats.py
get_by_folder_id
get_by_folder_id(folder_id: str) -> List[ChatResponse]
Get all chats in a specific folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_id
|
str
|
ID of the folder. |
required |
Returns:
| Type | Description |
|---|---|
List[ChatResponse]
|
List of full chat objects. |
Source code in src/owui_client/routers/chats.py
get_list_by_folder_id
Get a paginated list of chats in a folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_id
|
str
|
ID of the folder. |
required |
page
|
Optional[int]
|
Page number for pagination. |
1
|
Returns:
| Type | Description |
|---|---|
List[dict]
|
List of dictionaries containing basic chat info (id, title, updated_at). |
Source code in src/owui_client/routers/chats.py
get_pinned
get_pinned() -> List[ChatTitleIdResponse]
Get all pinned chats for the current user.
Returns:
| Type | Description |
|---|---|
List[ChatTitleIdResponse]
|
List of pinned chats. |
get_all
get_all() -> List[ChatResponse]
Get all chats for the current user.
Returns:
| Type | Description |
|---|---|
List[ChatResponse]
|
List of all chat objects. |
get_all_archived
get_all_archived() -> List[ChatResponse]
Get all archived chats for the current user.
Returns:
| Type | Description |
|---|---|
List[ChatResponse]
|
List of archived chat objects. |
Source code in src/owui_client/routers/chats.py
get_all_tags
get_all_tags() -> List[TagModel]
Get all tags used by the current user across all chats.
Returns:
| Type | Description |
|---|---|
List[TagModel]
|
List of tag objects. |
get_all_db
get_all_db() -> List[ChatResponse]
Get all chats in the database (Admin only).
Returns:
| Type | Description |
|---|---|
List[ChatResponse]
|
List of all chat objects for all users. |
Source code in src/owui_client/routers/chats.py
get_archived_list
get_archived_list(
page: Optional[int] = None,
query: Optional[str] = None,
order_by: Optional[str] = None,
direction: Optional[str] = None,
) -> List[ChatTitleIdResponse]
Get a paginated list of archived chats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
Optional[int]
|
Page number for pagination. |
None
|
query
|
Optional[str]
|
Search query string. |
None
|
order_by
|
Optional[str]
|
Field to order results by. |
None
|
direction
|
Optional[str]
|
Sort direction ('asc' or 'desc'). |
None
|
Returns:
| Type | Description |
|---|---|
List[ChatTitleIdResponse]
|
List of archived chats (lightweight). |
Source code in src/owui_client/routers/chats.py
archive_all
Archive all chats for the current user.
Returns:
| Type | Description |
|---|---|
bool
|
True if successful. |
unarchive_all
Unarchive all chats for the current user.
Returns:
| Type | Description |
|---|---|
bool
|
True if successful. |
get_shared
get_shared(share_id: str) -> Optional[ChatResponse]
Get a shared chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
share_id
|
str
|
The unique identifier for the shared chat. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The shared chat object. |
Source code in src/owui_client/routers/chats.py
get_by_tags
get_by_tags(
form_data: TagFilterForm,
) -> List[ChatTitleIdResponse]
Get chats filtered by tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
TagFilterForm
|
Filter options including the tag name and pagination. |
required |
Returns:
| Type | Description |
|---|---|
List[ChatTitleIdResponse]
|
List of chats matching the tag. |
Source code in src/owui_client/routers/chats.py
get
get(id: str) -> Optional[ChatResponse]
Get a chat by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The chat object. |
update
update(
id: str, form_data: ChatForm
) -> Optional[ChatResponse]
Update a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
form_data
|
ChatForm
|
The new chat data. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The updated chat object. |
Source code in src/owui_client/routers/chats.py
update_message
update_message(
id: str, message_id: str, form_data: MessageForm
) -> Optional[ChatResponse]
Update a specific message content within a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
message_id
|
str
|
The message ID. |
required |
form_data
|
MessageForm
|
The new message content. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The updated chat object. |
Source code in src/owui_client/routers/chats.py
send_message_event
send_message_event(
id: str, message_id: str, form_data: EventForm
) -> Optional[bool]
Send a socket event related to a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
message_id
|
str
|
The message ID. |
required |
form_data
|
EventForm
|
The event details. |
required |
Returns:
| Type | Description |
|---|---|
Optional[bool]
|
True if successful. |
Source code in src/owui_client/routers/chats.py
delete
Delete a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful. |
get_pinned_status
Get the pinned status of a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[bool]
|
True if pinned, False otherwise. |
Source code in src/owui_client/routers/chats.py
pin
pin(id: str) -> Optional[ChatResponse]
Toggle the pinned status of a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The updated chat object. |
Source code in src/owui_client/routers/chats.py
clone
clone(
id: str, form_data: CloneForm
) -> Optional[ChatResponse]
Clone a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the chat to clone. |
required |
form_data
|
CloneForm
|
Cloning options (e.g. new title). |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The new chat object. |
Source code in src/owui_client/routers/chats.py
clone_shared
clone_shared(id: str) -> Optional[ChatResponse]
Clone a shared chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The share ID of the shared chat. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The newly created chat object. |
Source code in src/owui_client/routers/chats.py
archive
archive(id: str) -> Optional[ChatResponse]
Toggle the archived status of a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The updated chat object. |
Source code in src/owui_client/routers/chats.py
share
share(id: str) -> Optional[ChatResponse]
Share a chat.
Generates or updates the share ID for the chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The updated chat object containing the share_id. |
Source code in src/owui_client/routers/chats.py
delete_shared
Unshare a chat (delete the shared link).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[bool]
|
True if successful. |
Source code in src/owui_client/routers/chats.py
update_folder
update_folder(
id: str, form_data: ChatFolderIdForm
) -> Optional[ChatResponse]
Move a chat to a folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
form_data
|
ChatFolderIdForm
|
The target folder ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[ChatResponse]
|
The updated chat object. |
Source code in src/owui_client/routers/chats.py
get_tags
get_tags(id: str) -> List[TagModel]
Get tags for a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
List[TagModel]
|
List of tags associated with the chat. |
Source code in src/owui_client/routers/chats.py
add_tag
Add a tag to a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
form_data
|
TagForm
|
The tag to add. |
required |
Returns:
| Type | Description |
|---|---|
List[TagModel]
|
Updated list of tags for the chat. |
Source code in src/owui_client/routers/chats.py
delete_tag
Remove a tag from a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
form_data
|
TagForm
|
The tag to remove. |
required |
Returns:
| Type | Description |
|---|---|
List[TagModel]
|
Updated list of tags for the chat. |
Source code in src/owui_client/routers/chats.py
delete_all_tags
Remove all tags from a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The chat ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[bool]
|
True if successful. |