UniGateway is a lightweight, high-performance LLM gateway designed for developers who use multiple AI tools (Cursor, Zed, Claude Code, etc.) and multiple providers (OpenAI, Anthropic, DeepSeek, Groq, etc.).
📦 Install
|
Or via Homebrew / Cargo:
🛠️ Usage
1. Quick Start
Run the interactive wizard to set up your first provider and generate a default configuration:
2. Managing the Server
UniGateway runs in the background. Use these commands to manage it:
3. Managing Modes
UniGateway organizes providers into Modes. Use the CLI to manage them:
3.5 External Admin API (Headless)
UniGateway does not embed a Web UI. External admin clients (for example UniAdmin)
should call JSON endpoints under /api/admin/*.
Authentication:
- If
UNIGATEWAY_ADMIN_TOKENis set, includex-admin-tokenon all admin requests. - If not set, behavior follows existing admin API defaults and is recommended only on trusted local networks.
Useful endpoints for external admin tools:
GET /api/admin/modes: list mode summaries for selector UIsPOST /api/admin/preferences/default-mode: setpreferences.default_modePATCH /api/admin/api-keys: rebind an existing API key to a targetservice_id
Routing semantics:
- Runtime HTTP routing uses the API key's
service_id. preferences.default_modeaffects CLI defaults and integration guidance.- To provide a one-click "switch mode" UX, admin clients should typically update default mode and key binding together.
Example curl flow:
# 1) List modes (summary)
# Optional: detailed mode payload (providers + keys)
# 2) Set default mode
# 3) Rebind an existing gateway key to a mode/service
Minimal JSON contract examples:
GET /api/admin/modes (summary)
POST /api/admin/preferences/default-mode
Request:
Response:
PATCH /api/admin/api-keys
Request:
Response:
Development networking notes:
- Preferred: configure a reverse proxy so UniAdmin and UniGateway share one origin.
- Local-only alternative: allow CORS in your dev stack (do not expose permissive CORS on public listeners).
One-click switch pattern for admin clients:
POST /api/admin/preferences/default-modeto update user-facing defaultPATCH /api/admin/api-keysto update runtime routing for the selected key
Detailed integration guide:
- See docs/admin-ui-support.md for endpoint contracts, suggested frontend workflow, and error handling recommendations.
3. Tool Integrations
Get ready-to-use configuration snippets or interactively set up your favorite AI tools:
4. Diagnostics & Testing
Understand routing and verify connectivity:
🔌 AI Integrations
UniGateway is designed for the modern AI ecosystem.
Popular Tool Configs
🛠️ Claude Code
Configure Claude Code to use UniGateway via the Anthropic-compatible endpoint:
# launch
ANTHROPIC_BASE_URL=http://127.0.0.1:3210 \
ANTHROPIC_API_KEY=ugk_your_key \
ANTHROPIC_MODEL=kimi-k2.5 \
Note: claude -p typically honors these env vars directly. In some CLI versions,
interactive claude may still show a login onboarding flow on first launch.
MCP (Model Context Protocol)
Manage your gateway through natural language in Cursor or Claude Desktop:
AI Agent Skills
Ships with a Skill file and OpenAPI spec to help AI agents automate your LLM infrastructure.
🚀 Key Features
- Unified Interface: OpenAI-compatible API for all providers, including Anthropic and local models.
- Mode-Based Routing: Group providers into semantic "modes" (e.g.,
fast,strong,backup) for easy switching. - Pre-configured Integrations: Get instant setup snippets for Cursor, Zed, Claude Code, and more.
- Failover & Stability: Built-in fallback strategies to ensure your AI tools keep working even if a provider goes down.
- Deep Visibility: Use
ug route explainandug doctorto understand exactly how requests are routed and debug connection issues. - MCP Server: Built-in Model Context Protocol server for AI assistants to manage the gateway.
📄 License
MIT. See LICENSE.