Introduction to ServBay AI Gateway
ServBay AI Gateway is a local unified AI provider gateway built into ServBay. It runs a proxy endpoint on your machine, consolidating requests to various large language model providers (nearly 20 providers, including OpenAI, Anthropic, DeepSeek, Qwen, etc.) into a single entry point. This helps you centrally manage keys, track usage and costs, and point AI coding tools such as Claude Code and Codex to the local gateway with one click.
This document explains what AI Gateway is, what problems it solves, and its overall architecture. For specific operations, see:
- Managing Channels — Add and configure providers
- Virtual Keys — Create, limit permissions, rotate, and revoke keys
- One-Click Takeover of AI Coding Tools — Point CLI tools such as Claude Code to the gateway
- Statistics and Monitoring — Usage, costs, and budgets
- Endpoints and Environment Variables — Call the gateway from your own code
Overview
In daily AI development, you may hold API keys from multiple providers at the same time, scattered across configuration files in different projects and tools. This makes it hard to track spending and hard to switch between them uniformly. ServBay AI Gateway brings these issues together in one place:
- One entry point for multiple providers — After configuring each provider channel, all requests are forwarded through the local
http://127.0.0.1:11580, so your application only needs to deal with one address. - Virtual keys instead of real keys — The gateway issues "virtual keys" to applications and tools, while real provider API keys are kept only on the gateway side instead of being scattered everywhere. Virtual keys can be restricted, rotated, and revoked at any time.
- Unified usage and cost view — All requests passing through the gateway are recorded. The gateway provides statistics on request count, token usage, cost, latency, multimodal usage, and more, and supports budget management.
- One-click takeover of mainstream AI coding tools — No need to manually edit configuration files. The gateway can point tools such as Claude Code, Codex, Qwen Code, Kimi CLI, CodeBuddy, opencode, and Crush to the local gateway with one click.
- Subscription accounts and quota tracking — Supports binding subscription-based provider accounts (such as Claude Pro / Max via OAuth authorization), visually displaying plan information, available endpoints, output length limits within the gateway, and tracking multi-window quotas in real time (used / remaining percentage, quota exhaustion status, reset time), so you can keep track of your subscription balance at any time.
- Channel capability detection and smart routing — When adding a channel, the gateway automatically detects provider capabilities (OAuth authorization type / coding plan type / tiered model type), and after confirmation, automatically writes the three-tier gateway mapping based on the detection result, so you don't need to manually guess model compatibility.
Architecture and Ports
AI Gateway consists of two local services, both listening only on the loopback address (127.0.0.1):
| Port | Purpose | Description |
|---|---|---|
11580 | Proxy port | Unified entry point for applications. Your code and managed AI tools send requests here, and the gateway routes them to the corresponding provider channel based on the virtual key's permissions. |
11581 | Management port | Used internally by the ServBay app to manage channels, keys, and statistics. It generally does not need to be accessed directly. |
The proxy port also provides endpoints in multiple compatible formats (OpenAI-compatible, Anthropic-compatible, Gemini-compatible). For details, see Endpoints and Environment Variables.
Supported Provider Channels
AI Gateway includes nearly 20 provider presets, grouped by category, which can be selected directly when adding a channel:
- Mainstream: OpenAI, Anthropic, Google Gemini, Azure OpenAI, AWS Bedrock, OpenRouter.
- China: DeepSeek, Qwen, Zhipu GLM, Kimi (Moonshot), Doubao · Volcano, ERNIE Bot, Hunyuan, MiniMax, 01.AI, StepFun. Among them, Qwen, Zhipu GLM, Kimi, Doubao · Volcano, Hunyuan, MiniMax, StepFun, etc. support switching between China / global dual-region 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 full add and configuration workflow, see Managing Channels.
Prerequisites
- ServBay is installed and running on macOS or Windows.
- AI Gateway is a value-added feature of ServBay. You need to sign in to your ServBay account before adding channels / keys. If you are not signed in, the interface will guide you through signing in.
TIP
AI Gateway has the same functionality on ServBay for macOS and ServBay for Windows. The proxy port (11580), management port (11581), and configuration file paths for managed tools are all the same. Any platform differences will be noted separately in the documentation.
Account and Plans
Some AI Gateway capabilities are tied to your ServBay account plan:
- Channel / key limits — Free and paid plans have different limits on the number of channels and virtual keys you can create. When you reach the limit, the interface will prompt you to upgrade.
- Quota and budget management — Quota-based limits (tokens / requests / amount) and the budget dashboard are VIP / paid capabilities. If you are not subscribed, the corresponding areas will be locked and prompt you to upgrade.
For plan details, see ServBay Pro and ServBay Team.
Subscription Accounts and Quota Tracking
AI Gateway supports binding subscription-based provider accounts (such as Claude Pro / Max connected via OAuth authorization), allowing you to view and manage these subscription resources directly within the local gateway without signing in to each provider's web console.
What Subscription Accounts Can Do
- Plan information at a glance — Display the subscription plan name, billing structure, and validity period.
- Available endpoints and output limits — View the list of endpoints available to the subscription account and the maximum output length limits for each model.
- Multi-window quota tracking — Visually display used / remaining quota percentages, whether the quota is currently exhausted, and quota reset times, helping you allocate subscription resources reasonably.
- Visible credential expiration — When the subscription account's authorization credentials expire or become invalid, the interface will clearly mark this and remind you to reauthorize.
Experimental Feature
OAuth authorization for subscription accounts is currently an experimental feature. Supported providers will expand gradually. During authorization, you need to complete the provider's OAuth flow in your browser. Authorization tokens are stored only locally.
Data Storage
- Data such as channel configurations, virtual keys, and usage statistics is maintained locally by the gateway backend service.
- The plaintext of a virtual key is displayed only once at creation (or rotation). After that, the gateway keeps only the prefix for identification, so be sure to copy and save it immediately upon creation.
- When taking over tools with one click, the gateway first backs up the target tool's original configuration file with a
.baksuffix, then writes the configuration pointing to the local gateway, making it easy to restore at any time.
Typical Workflow
- Sign in to your ServBay account and go to AI Gateway.
- On the Channels page, add at least one provider channel (such as OpenAI or DeepSeek), enter the real API key, and test connectivity.
- On the Virtual Keys page, create a virtual key and optionally restrict the available models / channels and rate limits.
- On the Endpoints page, enter the virtual key into your application, or use One-Click Takeover on the same page to configure your commonly used AI coding tools.
- On the Statistics and Monitoring page, monitor usage, costs, and latency, and set budgets if necessary.
Summary
ServBay AI Gateway consolidates the fragmented AI development landscape of "multiple providers, multiple keys, and multiple tools" into "one local entry point, one set of virtual keys, and one usage view." It lets you securely and centrally manage AI capabilities locally, keep precise control over costs, and connect various AI coding tools to a unified gateway with minimal effort. It is one of ServBay's core capabilities for AI-native development.
