Introduction to ServBay AI Gateway
ServBay AI Gateway is a local unified AI provider gateway built into ServBay. Running directly on your machine, it acts as a proxy endpoint that funnels requests to nearly 20 leading large language model providers—including OpenAI, Anthropic, DeepSeek, Qwen, and more—into a single entry point. This lets you centralize key management, track usage and costs, and instantly point AI programming tools like Claude Code, Codex, and Gemini CLI to your local gateway.
This document explains what the AI Gateway is, the problems it solves, and its overall architecture. For specific guides, refer to:
- Managing Channels — Add and configure AI providers
- Virtual Keys — Create, restrict, rotate, and revoke keys
- One-Click Takeover of AI Tools — Redirect CLI tools like Claude Code to the gateway
- Statistics & Monitoring — Usage, cost, and budgeting
- Endpoints & Environment Variables — Integrate the gateway into your code
Overview
In daily AI development, you might juggle multiple API Keys from various providers—scattered across different projects and tool configs—making it difficult to track spending or switch providers efficiently. ServBay AI Gateway centralizes all of this:
- One entry point, access multiple providers — Once you set up your channels, all traffic routes through the local
http://127.0.0.1:11580. Your apps only need to connect to one address. - Virtual keys instead of real keys — The gateway issues "virtual keys" for your apps and tools. Real provider API Keys are stored securely within the gateway and never scattered elsewhere. Virtual keys can be restricted, rotated, or revoked at any time.
- Unified usage & cost dashboard — Every request via the gateway is logged. Gain insights on request counts, token usage, cost, latency, and multimodal usage, with built-in budgeting features.
- Instant takeover of top AI dev tools — No need to manually edit config files. With one click, the gateway can redirect tools like Claude Code, Codex, Gemini CLI, Qwen Code, Kimi CLI, CodeBuddy, opencode, and Crush directly to the local gateway.
Architecture & Ports
The AI Gateway runs as two local services, each bound only to the loopback address (127.0.0.1):
| Port | Function | Description |
|---|---|---|
11580 | Proxy Port | Unified entry point for your applications. Your code and any managed AI tools send requests here, and the gateway routes them to the correct provider based on virtual key permissions. |
11581 | Management Port | Used internally by the ServBay app for managing channels, keys, and usage data. Direct access is usually not required. |
The proxy port supports multiple endpoint formats (OpenAI-compatible, Anthropic-compatible, Gemini-compatible). See Endpoints & Environment Variables for details.
Supported Providers
The AI Gateway has presets for nearly 20 providers, organized by region. Simply pick the provider when adding a new channel:
- Mainstream: OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, OpenRouter.
- China: DeepSeek, Qwen, Zhipu GLM, Kimi (Moonshot), Doubao · Volcano, Wenxin Yiyan, Hunyuan, MiniMax, ZeroOne, StepStar. For Qwen, Zhipu GLM, Kimi, Doubao · Volcano, Hunyuan, MiniMax, and StepStar, you can switch between domestic/global endpoints.
- Local: Ollama (default
127.0.0.1:11434), LM Studio (default127.0.0.1:1234). - Custom: OpenAI Compatible (any OpenAI-compatible service), Custom (fully customizable).
For the complete setup process, see Managing Channels.
Prerequisites
- ServBay must be installed and running on macOS or Windows.
- The AI Gateway is a premium ServBay feature; you must log in to your ServBay account before adding channels or keys. If you aren’t logged in, a prompt will guide you to do so.
TIP
The AI Gateway offers identical functionality on ServBay for macOS and ServBay for Windows. Proxy port (11580), management port (11581), and the config file paths for managed tools are all the same. Any platform differences will be specified where relevant.
Account & Plans
Some AI Gateway features are linked to your ServBay account plan:
- Channel / key limits — The number of channels and virtual keys you can create depends on your free or paid plan. You'll be prompted to upgrade if you hit the limit.
- Quota & budgeting tools — Limits (by token/request count or cost) and budget dashboards are VIP/paid features. These sections will be locked with an upgrade prompt if you’re unsubscribed.
For more on plans, check ServBay Pro and ServBay Team.
Data Storage
- Channel configurations, virtual keys, and usage stats are stored locally by the gateway backend.
- The plaintext of virtual keys is only shown once—when created or rotated. After that, only the prefix is saved for identification. Be sure to copy and save your key when it’s displayed.
- When you redirect tools, the gateway first backs up their original config files (with a
.baksuffix), then writes a new config pointing to the local gateway—so you can quickly revert changes as needed.
Typical Workflow
- Log in to your ServBay account and open the AI Gateway.
- On the Channels page, add at least one provider (e.g., OpenAI or DeepSeek), enter your real API Key, and verify connectivity.
- On Virtual Keys, create a virtual key—optionally restricting models, channels, or rate limits as needed.
- On the Endpoints page, enter the virtual key in your application or use One-Click Takeover to redirect your favorite AI dev tools.
- On Statistics & Monitoring, view usage, cost, and latency and set budgets as necessary.
Summary
ServBay AI Gateway streamlines fragmented AI development—across multiple providers, keys, and tools—into a unified local gateway with a single entry point, virtual keys, and one dashboard for usage and costs. It lets you securely and efficiently manage all your AI capabilities and spending right on your local machine, and with minimal effort, connect all your AI programming tools through one gateway. It's a core ServBay feature designed for AI-native development.
