Skip to content

A Local and global server host to use the DeepInfra Wrapper for free using Python requests

License

Notifications You must be signed in to change notification settings

itszerrin/DeepInfra-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. Clone the repository:

    git clone https://github.com/Recentaly/DeepInfra-Wrapper.git
  2. Install dependencies:

    pip install -r requirements.txt
  3. 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.

About

A Local and global server host to use the DeepInfra Wrapper for free using Python requests

Resources

License

Stars

Watchers

Forks

Packages

No packages published