A lightweight, flexible API proxy with dynamic token rotation, load balancing, and rate limiting capabilities.
Project description
🐾 NyaProxy - Universal API Proxy
Your Swiss Army Knife for API Proxy Management
🌟 Core Capabilities
| Feature | Description | Config Reference |
|---|---|---|
| 🔄 Token Rotation | Automatic key cycling across multiple providers | variables.keys |
| ⚖️ Load Balancing | 5 strategies: Round Robin, Random, Least Connections, Fastest Response, Weighted | load_balancing_strategy |
| 🚦 Rate Limiting | Granular controls per endpoint/key with smart queuing | rate_limit |
| 🕵️ Request Masking | Dynamic header substitution across multiple identity providers | headers + variables |
| 📊 Real-time Metrics | Interactive dashboard with request analytics and system health | dashboard.enabled |
🚀 Installation
Docker (Production)
docker run -d \
-p 8080:8080 \
-v ${PWD}/config.yaml:/app/config.yaml \
-v nya-proxy-logs:/app/logs \
k3scat/nya-proxy:latest
PyPI (Development)
pip install nya-proxy
nyaproxy --config config.yaml --log-level debug
📡 Service Endpoints
| Service | Endpoint | Description |
|---|---|---|
| API Proxy | http://localhost:8080/api/<endpoint_name> |
Main proxy endpoint for API requests |
| Dashboard | http://localhost:8080/dashboard |
Real-time metrics and monitoring |
| Config UI | http://localhost:8080/config |
Visual configuration interface |
Note: Replace 8080 with your configured port if different
🔧 API Configuration
OpenAI-Compatible APIs (Gemini, Anthropic, etc)
gemini:
name: Google Gemini API
endpoint: https://generativelanguage.googleapis.com/v1beta/openai
aliases:
- /gemini
key_variable: keys
headers:
Authorization: 'Bearer ${{keys}}'
variables:
keys:
- your_gemini_key_1
- your_gemini_key_2
load_balancing_strategy: least_requests
rate_limit:
endpoint_rate_limit: 75/d # Total endpoint limit
key_rate_limit: 5/m # Per-key limit
rate_limit_paths:
- "/v1/chat/*" # Apply limits to specific paths
- "/v1/images/*"
Generic REST APIs
novelai:
name: NovelAI API
endpoint: https://image.novelai.net
aliases:
- /novelai
key_variable: tokens
headers:
Authorization: 'Bearer ${{tokens}}'
variables:
tokens:
- your_novelai_token_1
- your_novelai_token_2
load_balancing_strategy: round_robin
rate_limit:
endpoint_rate_limit: 10/s
key_rate_limit: 2/s
🖥️ Management Interfaces
Real-time Metrics Dashboard
Monitor at http://localhost:8080/dashboard:
- Request volumes and response times
- Rate limit status and queue depth
- Key usage and performance metrics
- Error rates and status codes
Visual Configuration Interface
Manage at http://localhost:8080/config:
- Live configuration editing
- Syntax validation
- Variable management
- Rate limit adjustments
- Auto reload on save
🛡️ Advanced Reference Architecture (Advanced Deployment)
graph TD
A[Client] --> B[Nginx]
B --> C[NyaProxy]
C --> D[Auth Service]
D --> E[API Providers]
F[Monitoring] --> D
🌌 Future Roadmap
graph LR
A[Q3 2025] --> B[🔄 Smart Request Routing]
A --> C[📡 gRPC/WebSocket Support]
B --> D[📈 Auto-scaling Rules]
C --> E[📊 Protocol Analytics]
F[Q4 2025] --> G[🧩 Plugin System]
F --> H[🔍 Custom Metrics API]
❤️ Community
Need enterprise support? Contact k3scat@gmail.com
📈 Project Growth
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nya_proxy-0.0.4.tar.gz.
File metadata
- Download URL: nya_proxy-0.0.4.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8daf1b9f7305bd4401191074cb2d2e6caff803c547d712b57652d0fad387e3c0
|
|
| MD5 |
3e09fc5225886608fc7b09fce3313f42
|
|
| BLAKE2b-256 |
99fda8ded58119e59f5cf80f6549a722298707eb405bba541167b55eb5c47264
|
Provenance
The following attestation bundles were made for nya_proxy-0.0.4.tar.gz:
Publisher:
publish.yml on Nya-Foundation/NyaProxy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nya_proxy-0.0.4.tar.gz -
Subject digest:
8daf1b9f7305bd4401191074cb2d2e6caff803c547d712b57652d0fad387e3c0 - Sigstore transparency entry: 203311012
- Sigstore integration time:
-
Permalink:
Nya-Foundation/NyaProxy@0a593ca05d51ce05f9a4606c6868f8506caf651b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Nya-Foundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0a593ca05d51ce05f9a4606c6868f8506caf651b -
Trigger Event:
push
-
Statement type:
File details
Details for the file nya_proxy-0.0.4-py3-none-any.whl.
File metadata
- Download URL: nya_proxy-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1af712a7f02a2cbdb6064151a6e9df111c92127ef1ae24a9254e9073f477ca96
|
|
| MD5 |
1193a596761dd162384cb257c9edeea1
|
|
| BLAKE2b-256 |
0adfe18953e2e257a4ecd93442dfc65f1ee719e5a0cda83a1599f5786fd7a17d
|
Provenance
The following attestation bundles were made for nya_proxy-0.0.4-py3-none-any.whl:
Publisher:
publish.yml on Nya-Foundation/NyaProxy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nya_proxy-0.0.4-py3-none-any.whl -
Subject digest:
1af712a7f02a2cbdb6064151a6e9df111c92127ef1ae24a9254e9073f477ca96 - Sigstore transparency entry: 203311013
- Sigstore integration time:
-
Permalink:
Nya-Foundation/NyaProxy@0a593ca05d51ce05f9a4606c6868f8506caf651b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Nya-Foundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0a593ca05d51ce05f9a4606c6868f8506caf651b -
Trigger Event:
push
-
Statement type: