openai-forward  by KenyonY

LLM forwarding service for efficient API proxying

created 2 years ago
948 stars

Top 39.5% on sourcepulse

GitHubView on GitHub
Project Summary

OpenAI-Forward is an efficient, asynchronous reverse proxy service for large language models, designed to manage and optimize API requests. It targets developers and organizations looking to streamline access to LLMs, whether self-hosted or cloud-based, by providing features like rate limiting, intelligent caching, and API key management, ultimately reducing costs and improving response times.

How It Works

Leveraging Python's asyncio, uvicorn, and aiohttp, OpenAI-Forward offers high-performance asynchronous request handling. It supports forwarding requests to various LLM backends, including OpenAI and local models like LocalAI, through configurable routes. Key features include intelligent prediction caching (using FlaxKV backend in recent versions), granular user request and token rate limiting, custom API key forwarding, multi-target routing, IP-based black/whitelisting, and automatic request retries for enhanced stability.

Quick Start & Requirements

  • Install: pip install openai-forward or pip install openai-forward[webui] for UI support.
  • Run: aifd run or aifd run --webui to start the service.
  • Prerequisites: Python 3.7+ recommended.
  • Docs: Deploy Guide, Usage Guide.

Highlighted Details

  • Supports forwarding to arbitrary cloud models via a "general" type, enabling rate and token limiting without custom key support.
  • Intelligent caching stores AI predictions to accelerate access and reduce costs, with configurable behavior via extra_body for OpenAI-type forwards.
  • Offers a Web UI for configuration management since v0.7.0, simplifying setup and providing advanced options.
  • Includes robust logging capabilities, saving request/response details for analysis and conversion to JSON format.

Maintenance & Community

The project is actively maintained, with recent updates focusing on performance (FlaxKV cache) and usability (Web UI). Community contributions are welcomed via pull requests and issue reporting.

Licensing & Compatibility

Licensed under the MIT License, permitting commercial use and integration with closed-source applications.

Limitations & Caveats

Version 0.7.0 introduced breaking changes in configuration compared to previous versions. While flexible, the "general" forwarding type does not support custom API keys.

Health Check
Last commit

4 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
28 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.