Metadata-Version: 2.4
Name: owui-client
Version: 1.6.0
Summary: Unofficial async Python client for the complete Open WebUI API.
Project-URL: Author, https://willhogben.com
Project-URL: Repository, https://github.com/whogben/owui_client
Project-URL: Issues, https://github.com/whogben/owui_client/issues
Project-URL: Documentation, https://whogben.github.io/owui_client/
Author-email: William Hogben <whogben@gmail.com>
License: MIT
License-File: LICENSE
Keywords: api,client,open-webui
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Description-Content-Type: text/markdown

# Unofficial Open WebUI API Documentation and Python Client

[**📚 Full Documentation Site**](https://whogben.github.io/owui_client/)

This project provides **both** a robust, async Python client for the complete [Open WebUI](https://github.com/open-webui/open-webui) API **and** comprehensive unofficial documentation for the Open WebUI API in general.

## Python Client

A fully typed, async Python client that mirrors the backend structure of Open WebUI, providing an auto-completable interface for every endpoint.

### Target Open WebUI Version

This client is designed to work with the latest version of Open WebUI. The client is updated to stay in sync with the upstream Open WebUI backend.

For best compatibility, use this client with the latest Open WebUI release.

### Installation

```bash
pip install owui-client
```

### Quick Start

```python
import asyncio
from owui_client import OpenWebUI

async def main():
    # Connect to your Open WebUI instance
    client = OpenWebUI(
        api_url="http://localhost:8080/api", 
        api_key="sk-..."
    )

    # Example: Get current user info
    user = await client.auths.get_session_user()
    print(f"Hello, {user.name}!")

    # Example: List all models
    models = await client.models.get_models()
    for model in models.data:
        print(model.id)

if __name__ == "__main__":
    asyncio.run(main())
```

### Locating Endpoints

The client structure matches the Open WebUI backend router structure exactly. If you know the API endpoint or backend path, you know the client function.

| API Group | Client Attribute | Description |
| :--- | :--- | :--- |
| **Auth & Users** | `client.auths` | Sign in/up, API keys, session management |
| | `client.users` | User management, permissions, settings |
| | `client.groups` | Group management |
| **Content** | `client.chats` | Chat history, messages, archiving |
| | `client.prompts` | Prompt management |
| | `client.files` | File uploads and management |
| | `client.knowledge`| Knowledge base operations |
| **Inference** | `client.openai` | OpenAI-compatible chat completions & config |
| | `client.ollama` | Ollama configuration & endpoints |
| | `client.images` | Image generation endpoints |
| | `client.audio` | TTS and STT endpoints |
| **System** | `client.configs` | Global system configurations |
| | `client.models` | Model management (delete, update, import) |
| | `client.tools` | Tool management |
| | `client.functions`| Function management |

*Tip: Use your IDE's autocomplete on the `client` object to explore all available resources.*

## API Documentation

The [documentation site](https://whogben.github.io/owui_client/) provides comprehensive coverage of all API endpoints, models, and their fields. This includes **detailed descriptions of every field of every model**, calculated automatically by examining their usage in the Open WebUI source code.

The field descriptions are extracted from:

- Type annotations and Pydantic model definitions
- Docstrings and comments in the source code
- Actual usage patterns found throughout the codebase
- API response examples and validation logic

This documentation is useful even if you're not using the Python client - it serves as a complete reference for the Open WebUI API, including all valid key/values accepted by dict fields.

## Compatibility

This client is maintained to be compatible with the latest Open WebUI release. Due to the rapid development pace of Open WebUI, there may be brief periods where the client is slightly ahead or behind the latest release. The drift test in the test suite can help identify any discrepancies.
