DeepInfra-Wrapper is a Python Flask project designed to provide a convenient and free interface for utilizing the DeepInfra API through reverse-engineering. It serves as a local and global server host, allowing users to interact with the DeepInfra chat completion models using Python requests.
-
Local and Global Server: Choose between a local server or utilize a global server with Cloudflare integration for enhanced performance.
-
Chat Completion: Easily generate chat completions by sending messages to the DeepInfra API.
-
Model Selection: Access a variety of models for different use cases.
-
Streaming Support: Enable real-time streaming for dynamic chat interactions.
- Python 3.6 or higher
- Flask
- Flask-CORS
- Flask-Cloudflared
- Requests
- Fake User Agent
-
Clone the repository:
git clone https://github.com/Recentaly/DeepInfra-Wrapper.git
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
Adjust the configuration settings in the assets/config.json
file to customize your DeepInfra-Wrapper experience.
{
"use_global": true
}
Send a POST request to /chat/completions
with the following JSON payload (messages must be in OpenAI format):
{
"messages": [{"role": "user", "content": "Hello, World!"}],
"model": "meta-llama/Llama-2-70b-chat-hf",
"max_tokens": 150,
"top_p": 1,
"stream": true
}
Retrieve the available models by sending a GET request to /models
.
Verify the API status by accessing the root route /
.
The API gracefully handles errors, such as forbidden requests, providing meaningful error messages.
The server is also usable on This Google Colab Link
This project is licensed under the MIT License.
- Special thanks to the DeepInfra team for providing the chat completion models.
For issues and inquiries, please open an issue.