Skip to content

uwzis/OpenWebUIAPI-Proxy-Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenWebUI Proxy Server

Overview

This proxy server translates requests from OpenAI-compatible endpoints to the OpenWebUI API, allowing seamless integration with applications designed for OpenAI APIs.

Features

  • Seamless Integration: Works with applications expecting OpenAI API responses.
  • Preserves Authorization: Passes through the Authorization header for secure requests.
  • Timeout Handling: Increased timeout settings to handle longer processing times.
  • Logging and Debugging: Detailed logging for issue resolution.

Installation

  1. Clone the Repository

    git clone https://github.com/your-username/openwebui-proxy-server.git
    cd openwebui-proxy-server
  2. Install Dependencies

    Ensure you have Python 3 and pip installed, then run:

    pip install -r requirements.txt

Configuration

  1. Set OpenWebUI Base URL

    Update the OPENWEBUI_BASE_URL in the proxy_server.py file to point to your OpenWebUI server.

    OPENWEBUI_BASE_URL = "http://your-openwebui-url:3000"
  2. Run the Proxy Server

    You can run the proxy server using Flask or Gunicorn for better performance.

    Using Flask:

    python proxy_server.py

    Using Gunicorn (Recommended for Production):

    gunicorn -w 1 -k gevent --timeout 300 proxy_server:app --bind 0.0.0.0:5001

Usage

Example Requests

GET /v1/models

curl -X GET http://localhost:5001/v1/models \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"

POST /v1/chat/completions

curl -X POST http://localhost:5001/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "ytm-website",
    "messages": [{"role": "user", "content": "Why is the sky blue?"}]
}'

Logging

Detailed logging is included to help diagnose and resolve issues. Logs are output to the console by default.

# Example log entry
DEBUG:Request to OpenWebUI models: {'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json'}
DEBUG:Response from OpenWebUI models: 200 - {"models": ["model1", "model2"]}

Contributing

We welcome contributions to improve the functionality and robustness of this proxy server. Here’s how you can contribute:

  1. Fork the Repository

    git clone https://github.com/uwzis/openwebuiapi-proxy-service.git
    cd openwebuiapi-proxy-service
  2. Create a New Branch

    git checkout -b feature/new-feature
  3. Make Your Changes

  4. Commit and Push Your Changes

    git add .
    git commit -m "Add new feature"
    git push origin feature/new-feature
  5. Create a Pull Request

    Visit the repository on GitHub and create a pull request.

About

Proxy service for OpenWebUI's API to convert it to OpenAI API's format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy