Spaces:
Runtime error
DeepInfra-Wrapper
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.
Features
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.
Getting Started
Prerequisites
- Python 3.6 or higher
- Flask
- Flask-CORS
- Flask-Cloudflared
- Requests
- Fake User Agent
Installation
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
Configuration
Adjust the configuration settings in the assets/config.json
file to customize your DeepInfra-Wrapper experience.
{
"use_global": true
}
Usage
Chat Completion
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
}
Get Models
Retrieve the available models by sending a GET request to /models
.
Check API Status
Verify the API status by accessing the root route /
.
Error Handling
The API gracefully handles errors, such as forbidden requests, providing meaningful error messages.
Google Colab
The server is also usable on This Google Colab Link
License
This project is licensed under the MIT License.
Acknowledgments
- Special thanks to the DeepInfra team for providing the chat completion models.
Contact
For issues and inquiries, please open an issue.