The problem: You pay for GitHub Copilot ($10/mo), ChatGPT Plus/Codex ($20/mo), Claude Pro ($20/mo), Google Antigravity, xAI Grok, DeepSeek, and Z.ai. That's $100+/month in flat-rate AI subscriptions.
Yet every time you spin up an autonomous coding agent--, , , , or --you are forced to supply raw, pay-as-you-go API keys that burn money per token. Meanwhile, your monthly subscriptions sit idle 85% of the day.
Agent-first universal LLM subscription proxy. One OpenAI/Anthropic-compatible endpoint for Copilot, Antigravity, Codex, Grok, Freebuff, Z.ai, Augure, DeepSeek, OpenRouter, vLLM & more. Quota-aware routing, per-API-key accounting, MCP server.
The solution:Ultiproxy pools all your subscriptions into ONE local endpoint at :9050 that natively speaks both OpenAI (POST /v1/chat/completions) and Anthropic (POST /v1/messages) -- and exposes its entire control plane over MCP, so an agent can wire it up itself.
Zero-Config Startup: ultiproxy serve is the whole installation step. Nothing to author, nothing to edit, nothing to reload: lanes, aliases and timeouts are added at runtime over MCP and persist in the daemon's data dir (providers.json, aliases.json, timeouts.json).
MCP-Native Control Plane: every knob an operator would touch is an MCP tool at http://localhost:9050/mcp -- add_provider, set_model_alias, set_provider_timeout, get_quota_status, initiate_oauth_login, ... An agent can bootstrap the whole gateway on its own. There is no separate admin CLI to install or remember: the daemon binary only serves, and MCP is the sole control plane.
Zero-Marginal-Cost Pooling: Run agents 24/7 on your flat subscriptions. Stop paying per-token API bills for workloads you've already paid for.
Quota Monitoring, Not Quota Routing: live per-provider quota windows and credit state via the MCP get_quota_status tool, /api/quota, and quota.txt. Operators and agents decide routing; the proxy never reroutes on quota by itself.
Per-API-Key Accounting: scoped client keys (sk-up-agent-a, sk-up-ci-worker) with granular tracking of prompt tokens, completion tokens, cached tokens, requests and cost.
Reasoning & Tool Passthrough: flawless streaming for thinking tokens (reasoning_content in o1/DeepSeek-R1), tool calls, and multi-image vision inputs.
Agent-First, Zero GUI Bloat: a single high-performance Go daemon. No Electron runtime, no dashboard to click through, sub-millisecond routing latency.
Agent-First Quickstart
Ultiproxy starts with zero configuration: nothing to author, nothing to reload, and nothing that has to be in place before the first request. You boot the daemon, then you (or your agent) configure everything else over MCP while it runs.
0. Install (once)
# Precompiled binary into ~/.local/bin (no root required):
curl -fsSL https://raw.githubusercontent.com/smhanov/ultiproxy/main/dist/install.sh | sh
# ...or build from source (this repo only):
git clone https://github.com/smhanov/ultiproxy
cd ultiproxy
go build -o ultiproxy ./cmd/ultiproxy
The installer also installs a hardened systemd user unit on Linux. Review it first with bash dist/install.sh --dry-run if you prefer.
Building from source needs only this repository and Go 1.25 or newer
(go.mod declares go 1.25.0). The provider library
github.com/smhanov/llmhub is consumed as a normal published Go module
pinned in go.mod -- no extra checkouts required:
git clone https://github.com/smhanov/ultiproxy
cd ultiproxy
go build -o ultiproxy ./cmd/ultiproxy
1. Start the daemon
# Directly:
ultiproxy serve
# Or as a hardened systemd user service (what the installer sets up on Linux):
systemctl --user enable --now ultiproxy
# Or bound to all interfaces for remote agents, still with no configuration:
ULTIPROXY_ADDR=0.0.0.0:9050 ultiproxy serve
By default the daemon listens on 127.0.0.1:9050 and accepts every request, which is the right posture for a localhost-only install. Declaring client keys turns on authentication and gives you per-key attribution; upstream credentials are never exposed to clients either way. Two spellings are accepted on every route (including /api/quota and the stats endpoints): Authorization: Bearer <key> for OpenAI-style clients and x-api-key: <key> for Anthropic SDKs and Claude Code.
2. Connect your agent to the embedded MCP server
Streamable HTTP at http://localhost:9050/mcp (legacy SSE at http://localhost:9050/mcp/sse):
For OAuth lanes, drive the flow instead of pasting keys:
# 1) get the sign-in URL (and user_code for device flows such as xai)
{"name":"initiate_oauth_login","arguments":{"provider":"antigravity"}}
# 2a) auth-code flow: copy the code=... value out of the browser callback URL
{"name":"submit_oauth_code","arguments":{"provider":"antigravity","code":"4/0A..."}}
# 2b) device flow: poll until it answers "completed"
{"name":"check_oauth_login","arguments":{"provider":"xai"}}
An OAuth lane must be added with auth_via_oauth_manager so its stored credential (refresh token included) actually drives the lane. Static api_key lanes never refresh, which is how a lane dies overnight:
Re-adding a lane this way reuses the credential file already in the daemon's data dir (<data_dir>/credentials/<lane>/); only a dead refresh token needs another initiate_oauth_login.
Aliases, lanes and timeouts all survive a restart: the daemon re-reads its data dir and rebuilds the registry, so nothing has to be re-applied.
5. Point your agents at the endpoint
OpenAI clients: http://localhost:9050/v1
Anthropic clients: http://localhost:9050
MCP Tools
Everything below is available on tools/list at http://localhost:9050/mcp, with full self-describing docstrings -- an agent never needs this README to operate the proxy.
Tool
What it does
list_models
Client-visible model ids with their lane, enabled state, window (context_limit / context_length / max_model_len), output cap (max_output / max_output_tokens), modalities (architecture, supports_vision), pricing tag, capabilities and source (alias / discovery / default). Same id set and same metadata precedence as GET /v1/models, so the two surfaces cannot drift; ids disabled with toggle_model stay listed with enabled: false.
get_quota_status
Real-time quota/credit status for one lane (antigravity, xai, copilot, codex, freebuff, zai, ...): used %, remaining, units, reset times. Monitoring only -- never auto-reroutes.
toggle_model
Enable/disable a model id at runtime without deleting its mapping.
get_client_usage
Token (prompt, completion, cached) and request usage per client key or overall, over a window such as 1h, 24h, 7d.
initiate_oauth_login
Non-blocking OAuth start for subscription lanes; returns the sign-in URL and the device user_code.
check_oauth_login
Poll a pending device-flow login (e.g. xai) or complete a server-side token exchange.
submit_oauth_code
Submit the authorization code from the redirect callback URL (e.g. antigravity).
list_model_aliases
Alias -> provider lane + upstream model id, with limits and pricing.
set_model_alias
Create/update an alias mapping (provider, upstream, optional context_limit, max_output, input_modalities / output_modalities, pricing_tag, input_cost, output_cost); persists in aliases.json. Alias metadata overrides live discovery and the static catalog on GET /v1/models / list_models.
remove_model_alias
Delete an alias mapping by name.
get_provider_timeouts
Per-lane timeout durations in force.
set_provider_timeout
Configure a lane timeout (Go duration string: 10m, 3m30s, ...); persists in timeouts.json.
remove_provider_timeout
Reset a lane to the server default timeout (120s).
add_provider
Register a lane at runtime -- OpenAI-compatible (name, base_url, optional api_key, quirks) or custom-wire kinds (antigravity, anthropic, codex, freebuff); persists in providers.json. OAuth lanes (e.g. xai) must be added with quirks: {"auth_via_oauth_manager": true} and an empty api_key so the stored credential drives the lane. The reply reports how many upstream models the lane serves ("discovered N models") -- discovery already ran.
remove_provider
Unregister a lane from the registry and from providers.json.
list_providers
Runtime-registered and compiled/in-memory lanes, secrets redacted.
refresh_models
Re-fetch GET <base>/v1/models and cache it so <lane>/<model> ids appear in /v1/models. Manual override -- discovery also runs at registration, at startup for lanes whose cache is empty, and every 6h afterwards.
Only routable canonical model ids: <lane>/<model> per discovered upstream model, and <lane>/<default> for lanes with a default model (e.g. antigravity/gemini-3.7-flash-high). User aliases from set_model_alias are listed under their canonical target. Each row carries the metadata a client needs to pick a model, when a source actually reported it: context_length and max_model_len (the same window under the OpenRouter/LiteLLM and vLLM names), max_output_tokens, and architecture.input_modalities / architecture.output_modalities plus supports_vision: true when image is an input. Precedence, per field: operator alias (context_limit, max_output, input_modalities / output_modalities via set_model_alias) > live discovery > cited static catalog (pkg/modelmeta, extendable with data_dir/windows.json) > omit. Unknown keys are omitted -- never 0, false, [] -- and the legacy max_tokens name is never emitted. Windows are read from every dialect the upstreams speak (max_model_len, context_length, top_provider.context_length, meta.context_length, meta.n_ctx, context_window, meta.n_ctx_train; Anthropic max_input_tokens), output caps from top_provider.max_completion_tokens, max_output_tokens, max_completion_tokens (Anthropic max_tokens), and modalities from architecture.input_modalities / output_modalities, top-level modality arrays, architecture.modality ("text+image->text") or supports_vision, normalized to `text
POST /mcp, GET /mcp
Streamable HTTP MCP server (JSON-RPC 2.0).
GET /mcp/sse
Legacy SSE MCP transport.
GET /api/quota, /quota.txt, /quota.md
Live quota dashboard, plain-text and Markdown views. Authenticated like every other route when client keys are configured.
GET /api/stats/summary
Aggregated request, prompt/completion/cached token and client counts, per-provider breakdown, and the pay-as-you-go equivalent cost (estimated_cost_saved_usd).
GET /api/stats/by-client
Per-client-key accounting over a ?window= lookback (default 7d): request, token, cost and error counts plus last_active.
GET /healthz, GET /llms.txt
Health probe and machine-readable overview for LLMs.
Supported Providers (11 + Local)
Ultiproxy fronts 11 cloud subscription providers and local self-hosted runtimes. Lanes are added at runtime over MCP -- OAuth subscription lanes through initiate_oauth_login, keyed API lanes through add_provider:
Provider
Subscription Needed
Notes
GitHub Copilot
Pro / Business / Enterprise
GPT-4o, Claude 3.5 Sonnet, o1; automatic GitHub token refresh
DeepSeek-V3, DeepSeek-R1; full reasoning chain passthrough
OpenRouter
OpenRouter Credits / Tier
Fallback gateway routing across 200+ models
Anthropic
Claude Pro / Team Console
Claude 3.5 Sonnet, Claude 3 Opus, Haiku
OpenCode Go
OpenCode Membership
Optimized coding pipeline backend
Local vLLM
None (Local GPU / Hardware)
Llama 3, Qwen 2.5 Coder, Mistral; zero latency & zero marginal cost
Any other OpenAI-compatible upstream (OpenRouter-style gateways, llama.cpp, TGI, another proxy) is one add_provider call away.
Security & Architecture
Single Key Surface: Clients talk to Ultiproxy with one client key (sk-up-...). Upstream subscription credentials and OAuth refresh tokens stay inside the daemon's credential store and never reach a client or a network trace.
Localhost by Default: the daemon binds 127.0.0.1:9050; ULTIPROXY_ADDR is the only switch needed to expose it to remote agents.
Per-API-Key Accounting: track token usage by agent, workload or team member via get_client_usage and GET /api/stats/summary.
State Belongs to the Daemon: runtime changes made over MCP are persisted atomically under the data dir (providers.json, aliases.json, timeouts.json) and restored on the next start -- no restart ritual, no drift between what you asked for and what runs.
System Hardening: the systemd user service (dist/ultiproxy.service) enforces strict process boundaries (ProtectSystem=strict, NoNewPrivileges=true, isolated StateDirectory=ultiproxy).
Automatic Token Refresh: OAuth credentials never hard-expire. A background refresher walks every lane every 5 minutes and refreshes any credential with less than 10 minutes of life left -- no inbound request needed, so an idle lane still works the next morning. If the upstream rejects a credential anyway (401/403 bad-credentials), the lane invalidates it, mints a fresh one and retries exactly once, before the first byte of a response or stream; a second consecutive rejection is returned to the client honestly. Refresh log lines carry the lane name and the new expiry, never a token.
Honest Routing: an unknown model is a 404 unknown_model, never a silent detour to another vendor; tools against a lane without tool support is a 409 model_does_not_support_tools. Failover happens only before the first byte.
Troubleshooting
bind: address already in use on startup. The daemon exits non-zero when its listen address is taken and prints a hint naming ULTIPROXY_ADDR. The usual collision is the default port: 127.0.0.1:9050 is also Tor's SOCKS port, so on a machine running Tor (or a second ultiproxy) bind something else instead — e.g. ULTIPROXY_ADDR=127.0.0.1:9051 ultiproxy serve. The default stays 127.0.0.1:9050 everywhere else in these docs. A client pointed at a port owned by another service gets that service's answer (Tor replies with an HTML "This is a SOCKS proxy" page), so if responses look alien, check what actually owns the port before debugging the proxy.
Contributing
Pull requests are welcome! Ensure you adhere to the project standards:
API changes must update docs/openapi.yaml and llms.txt.
MCP tool docstrings in pkg/mcp/tools.go are the agent-facing documentation -- keep them complete and self-contained.
Verification gates must pass before submitting PRs (go build ./..., go test ./..., go vet ./...).
License
MIT (c) 2026 Ultiproxy Contributors.
U
Ultiproxy
smhanov·3 顆星·
Agent-first universal LLM subscription proxy. One OpenAI/Anthropic-compatible endpoint for Copilot, Antigravity, Codex, Grok, Freebuff, Z.ai, Augure, DeepSeek, OpenRouter, vLLM & more. Quota-aware rou