-
Notifications
You must be signed in to change notification settings - Fork 250
Description
Feature Request: LLM-API-Key-Proxy Provider Support
Summary
Would love to see CodexBar support LLM-API-Key-Proxy — a self-hosted proxy that aggregates multiple LLM providers with key rotation, quota tracking, and usage statistics.
Background
LLM-API-Key-Proxy is a FastAPI-based proxy server that:
- Provides unified OpenAI/Anthropic-compatible endpoints for multiple LLM providers
- Supports 15+ providers: Gemini, OpenAI, Anthropic, OpenRouter, Gemini CLI, Antigravity, Qwen, Cohere, Mistral, and more
- Handles automatic key rotation, failover, and cooldown management
- Tracks detailed usage statistics per provider and per credential
This proxy is used to manage multiple API keys and OAuth credentials across providers, with full visibility into quota consumption.
Why This Would Be Valuable
Unlike other providers that CodexBar already supports individually, the proxy aggregates multiple providers behind a single endpoint. The key insight is:
Each provider tracked by the proxy should appear as a separate entry in CodexBar, not converged into a single "Proxy" provider.
Or allow for a single provider entry to have subprovider entries.
API Details
The proxy exposes a well-designed REST API for statistics:
Endpoint: GET /v1/quota-stats
Auth: Authorization: Bearer <PROXY_API_KEY>
Response structure:
{
"providers": {
"antigravity": {
"credential_count": 3,
"active_count": 2,
"exhausted_count": 1,
"total_requests": 150,
"tokens": {
"input_cached": 50000,
"input_uncached": 100000,
"output": 25000
},
"approx_cost": 1.25,
"quota_groups": {
"opus": { "remaining_percent": 45.2, "reset_time": "2026-01-29T00:00:00Z" }
},
"credentials": [
{
"name": "antigravity_oauth_1.json",
"status": "active",
"requests": 50,
"quota_remaining_percent": 62.5,
"last_used_timestamp": 1706470800.0
}
]
},
"gemini_cli": { ... },
"openrouter": { ... }
},
"summary": {
"total_providers": 5,
"total_credentials": 12,
"active_credentials": 10
},
"timestamp": 1706470800.0
}Suggested Implementation
Option A: Dynamic sub-providers (preferred)
- Register a single "LLM Proxy" meta-provider
- For each provider in the API response, create a virtual sub-provider entry
- Each sub-provider maps to CodexBar's existing provider types where possible (e.g.,
antigravity→ Antigravity icon) - Unknown providers get a generic "Proxy" icon with the provider name
Option B: Aggregate view
- Single provider showing "worst" quota across all proxy providers
- Expandable detail view showing per-provider breakdown
Configuration Needed
- Proxy URL (default:
http://127.0.0.1:8000) - API Key (stored in Keychain)
Data Mapping
LLM-Proxy API → CodexBar
─────────────────────────────────────────────────────────────
providers[x].quota_groups[y] → RateWindow per quota tier
.remaining_percent → RateWindow.remainingPercent
.reset_time → RateWindow.resetsAt
providers[x].credentials[y].status → Provider health indicator
providers[x].total_requests → Display in menu card
providers[x].approx_cost → ProviderCostSnapshot
Implementation Notes
- The existing Antigravity provider is a good template (also probes a local HTTP service)
- The proxy already has a quota_viewer.py TUI that shows exactly how to consume and display this data
- Refresh is supported:
POST /v1/quota-statswith{"action": "force_refresh"}