A Rust-based API load balancer and key manager for Gemini API requests.
- Load balancing across multiple Gemini API keys
- Rate limiting per API key
- OpenAI-compatible endpoint support
- Round-robin routing strategy
- Docker support
- Docker and Docker Compose
- Gemini API keys
- Clone the repository:
git clone https://github.com/yourusername/rust-api-spinner-v3.git
cd rust-api-spinner-v3
- Create your environment file:
cp .env.example .env
-
Edit
.env
and add your Gemini API keys -
Build and run with Docker Compose:
docker-compose up --build
The service will be available at http://localhost:3002
The service can be configured through environment variables in the .env
file:
API_SPINNER_KEY_CONFIG
: JSON configuration for API keys and rate limitsGEMINI_DIRECT_ENABLED
: Enable direct Gemini API endpointGEMINI_DIRECT_URL
: Gemini API base URLOPENAI_COMPATIBLE_ENABLED
: Enable OpenAI-compatible endpointOPENAI_COMPATIBLE_URL
: OpenAI-compatible endpoint URLOPENAI_COMPATIBLE_MODEL
: Model to use for OpenAI-compatible endpointDEFAULT_PROVIDER
: Default API providerAPI_SPINNER_LISTEN_ADDR
: Address to listen onROUTING_STRATEGY
: Routing strategy (round-robin)
MIT License - see LICENSE file for details