One-Click Takeover for AI Coding Tools
The One-Click Takeover feature allows you to seamlessly redirect popular AI coding CLI tools to your local AI gateway—no manual editing of configuration files required. Once taken over, requests from these tools are uniformly routed through http://127.0.0.1:11580 to the provider channels configured in your gateway, enabling unified usage and cost tracking.
How It Works
When you initiate a one-click takeover for a tool, the gateway performs the following steps:
- Checks gateway health status to ensure the proxy endpoint is available.
- Automatically creates a dedicated virtual key (the plaintext key is only shown during creation and written into the tool's configuration).
- Backs up the original configuration file by appending a
.baksuffix (e.g.,~/.claude/settings.json.bak). - Precisely writes or deeply merges the gateway configuration, keeping your other settings unchanged.
- Refreshes the interface status, displaying the current takeover status.
When removing takeover, the process is equally precise: configuration keys are only removed if they were set to point to this gateway, avoiding accidental deletion of your custom settings.
Takeover Status
On the AI Gateway → Endpoints page, each tool will display one of four statuses:
| Status | Meaning |
|---|---|
| Taken Over (This Gateway) | The tool is pointed to the local AI gateway |
| Connected (Other Address) | The tool is configured with another address (set manually or pointed to another gateway); ServBay won’t overwrite |
| Not Taken Over | The tool is detected but not yet pointed to the gateway |
| Not Detected | The configuration directory for this tool was not found on the machine |
Prerequisites
- You are logged into your ServBay account and have configured at least one usable channel on the Channels page.
- The target AI tool is already installed locally (existence is determined by its configuration directory).
Using One-Click Takeover
Go to AI Gateway → Endpoints, locate your desired tool in the list, and click One-Click Takeover. A successful takeover will change the status to "Taken Over (This Gateway)". To revert, click Remove / Restore.
Tool-Specific Takeover Details
The table below lists the actual configuration files and content changes for each tool. This can help you understand or troubleshoot the process:
| Tool | Config File | Written Content | Gateway Address |
|---|---|---|---|
| Claude Code | ~/.claude/settings.json | env.ANTHROPIC_BASE_URL + env.ANTHROPIC_AUTH_TOKEN | http://127.0.0.1:11580 (without /v1) |
| Codex | ~/.codex/config.toml | [model_providers.servbay] section + top-level model_provider = "servbay" | http://127.0.0.1:11580/v1 |
| Gemini CLI | ~/.gemini/.env | GOOGLE_GEMINI_BASE_URL + GEMINI_API_KEY (two lines) | http://127.0.0.1:11580 |
| Qwen Code | ~/.qwen/.env | OPENAI_BASE_URL + OPENAI_API_KEY (OpenAI compatible) | http://127.0.0.1:11580/v1 |
| Kimi CLI | ~/.kimi/config.toml | [model_providers.servbay] section + model definition | http://127.0.0.1:11580/v1 |
| CodeBuddy | ~/.codebuddy/models.json | Deep merge for servbay model node | http://127.0.0.1:11580/v1 |
| opencode | ~/.config/opencode/opencode.json | Deep merge for provider.servbay node (aggregate models across channels) | http://127.0.0.1:11580/v1 |
| Crush | ~/.config/crush/crush.json | Deep merge for providers.servbay node | http://127.0.0.1:11580/v1 |
Why doesn’t Claude Code include /v1 in its address
Claude Code uses the Anthropic protocol, where the gateway automatically appends paths like /v1/messages, so ANTHROPIC_BASE_URL must be the gateway root address (without /v1). Most other tools use the OpenAI-compatible protocol, which requires the /v1 suffix. One-Click Takeover fills in the correct address per tool convention—you don’t need to adjust it manually.
Restore and Troubleshooting
- Restore original configuration — Click Remove and the gateway will precisely remove only the configuration pointing to it. Alternatively, you can manually restore using the
.bakbackup in the same directory. - Status shows "Connected (Other Address)" — This means the tool is currently set to another address (either manually or to a different gateway). To prevent overwriting your settings, the gateway will not take over automatically; clear the config and retry if desired.
- Errors persist after takeover — Check whether the gateway proxy service is running, the selected channel is healthy, and the virtual key hasn’t been revoked. You can also view whether requests reach the gateway from the Statistics & Monitoring page.
Frequently Asked Questions (FAQ)
- Q: Will One-Click Takeover break my existing tool configurations?
- A: No. The gateway only writes or merges keys related to the gateway and always backs up the original file as
.bakbefore making any changes. Other settings remain untouched.
- A: No. The gateway only writes or merges keys related to the gateway and always backs up the original file as
- Q: Can I manually revert changes after takeover?
- A: Yes. Use the "Remove" button to let the gateway roll back, or manually restore from the
.bakbackup.
- A: Yes. Use the "Remove" button to let the gateway roll back, or manually restore from the
- Q: Where can I find the virtual key used for takeover?
- A: The gateway automatically creates a dedicated virtual key for each tool. You can view and manage them on the Virtual Keys page.
- Q: Why does a tool show "Not Detected" in the list?
- A: It means the configuration directory for that tool wasn’t found locally. Please install and run the tool at least once to generate its config directory before takeover.
Summary
One-Click Takeover transforms the tedious and error-prone task of manually editing multiple tool configs into a single action—automatically generating keys, backing up original files, writing changes precisely, and allowing instant restoration. Combined with centralized channel and usage tracking, you can unify supplier settings and cost visibility across all your AI coding tools. If you want to call the gateway from inside your own code, see Endpoints and Environment Variables.
