Skip to content

junfeiwa/rust-api-spinner-v3-latest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Spinner

A Rust-based API load balancer and key manager for Gemini API requests.

Features

  • Load balancing across multiple Gemini API keys
  • Rate limiting per API key
  • OpenAI-compatible endpoint support
  • Round-robin routing strategy
  • Docker support

Prerequisites

  • Docker and Docker Compose
  • Gemini API keys

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/rust-api-spinner-v3.git
cd rust-api-spinner-v3
  1. Create your environment file:
cp .env.example .env
  1. Edit .env and add your Gemini API keys

  2. Build and run with Docker Compose:

docker-compose up --build

The service will be available at http://localhost:3002

Configuration

The service can be configured through environment variables in the .env file:

  • API_SPINNER_KEY_CONFIG: JSON configuration for API keys and rate limits
  • GEMINI_DIRECT_ENABLED: Enable direct Gemini API endpoint
  • GEMINI_DIRECT_URL: Gemini API base URL
  • OPENAI_COMPATIBLE_ENABLED: Enable OpenAI-compatible endpoint
  • OPENAI_COMPATIBLE_URL: OpenAI-compatible endpoint URL
  • OPENAI_COMPATIBLE_MODEL: Model to use for OpenAI-compatible endpoint
  • DEFAULT_PROVIDER: Default API provider
  • API_SPINNER_LISTEN_ADDR: Address to listen on
  • ROUTING_STRATEGY: Routing strategy (round-robin)

License

MIT License - see LICENSE file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published