This is an OpenAI-compatible API that provides a seamless interface for interacting with The Horde. It supports chat completions and text completions..
- Python 3.7 or higher
- FastAPI
- python-dotenv
-
Clone the repository:
git clone https://github.com/GoldenWind8/horde-openai-proxy.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up the environment variables:
- Create a
.env
file in the project root directory. - Define the following variables in the
.env
file:API_KEY=your_api_key BASE_URL=horde_url
- Replace
your_api_key
with your actual API key.
- Create a
-
Start the API server:
uvicorn main:app --reload
-
The API will be accessible at
https://localhost:8000
.
- Endpoint:
/v1/chat/completions
- Method: POST
- Description: Generates a chat completion based on the provided conversation context.
- Documentation: OpenAI Chat Completion API
- Endpoint:
/v1/completions
- Method: POST
- Description: Generates a text completion based on the provided prompt.
- Documentation: OpenAI Completion API
The API can be configured using environment variables defined in the .env
file:
API_KEY
: The API key for authentication. Defaults to"0000000000"
if not provided.BASE_URL
: The base URL for the Horde Compatible API. Defaults to an empty string if not provided.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.