enh: api doc

This commit is contained in:
Timothy J. Baek 2024-09-25 13:58:33 +02:00
parent cb077d71a6
commit 69f73b094a

View File

@ -3,14 +3,58 @@ sidebar_position: 5
title: "🔗 Open WebUI API Endpoints"
---
## Swagger Docs
Welcome to the Open WebUI API! 🚀 This guide provides essential information on how to interact with the API endpoints effectively to achieve seamless integration and automation using our models. Please note that this is an experimental setup and may undergo future updates for enhancement.
| App | Docs Path |
|----------|---------------------|
| Main | /docs |
| WebUI | /api/v1/docs |
| Ollama | /ollama/docs |
| OpenAI | /openai/docs |
| Images | /images/api/v1/docs |
| Audio | /audio/api/v1/docs |
| RAG | /rag/api/v1/docs |
## Authentication
To ensure secure access to the API, authentication is required 🛡️. You can authenticate your API requests using the Bearer Token mechanism. Obtain your API key from **Settings > Account** in the Open WebUI, or alternatively, use a JWT (JSON Web Token) for authentication.
### Notable API Endpoints
#### Retrieve All Models
- **Endpoint**: `GET /api/models`
- **Description**: Fetches all models created or added via Open WebUI.
- **Example**:
```bash
curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:3000/api/models
```
#### Chat Completions
- **Endpoint**: `POST /api/chat/completions`
- **Description**: Serves as a chat completion endpoint compatible with various models including Ollama models, OpenAI models, and Open WebUI Function models.
- **Example**:
```bash
curl -X POST http://localhost:3000/api/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.1",
"messages": [
{
"role": "user",
"content": "Why is the sky blue?"
}
]
}'
```
## Advantages of Using Open WebUI as a Unified LLM Provider
Open WebUI offers a myriad of benefits, making it an essential tool for developers and businesses alike:
- **Unified Interface**: Simplify your interactions with different LLMs through a single, integrated platform.
- **Ease of Implementation**: Quick start integration with comprehensive documentation and community support.
## Swagger Documentation Links
Access detailed API documentation for different services provided by Open WebUI:
| Application | Documentation Path |
|-------------|----------------------|
| Main | `/docs` |
| WebUI | `/api/v1/docs` |
| Ollama | `/ollama/docs` |
| OpenAI | `/openai/docs` |
| Images | `/images/api/v1/docs`|
| Audio | `/audio/api/v1/docs` |
| RAG | `/rag/api/v1/docs` |
Each documentation portal offers interactive examples, schema descriptions, and testing capabilities to enhance your understanding and ease of use.
By following these guidelines, you can swiftly integrate and begin utilizing the Open WebUI API. Should you encounter any issues or have questions, feel free to reach out through our Discord Community or consult the FAQs. Happy coding! 🌟