One-Click Takeover for AI Coding Tools
One-click takeover lets you point your commonly used AI coding CLI tools to the local AI Gateway without manually editing any configuration files. After takeover, requests from these tools are routed through http://127.0.0.1:11580 to the provider channels you configured in the gateway, and are included in unified usage and cost statistics.
How It Works
When you perform one-click takeover for a tool, the gateway completes the following steps in order:
- Checks gateway health to confirm the proxy endpoint is available.
- Automatically creates a dedicated virtual key (the gateway writes it into the tool configuration; the plaintext can be retrieved at any time on the Keys page).
- Backs up the original configuration file with a
.baksuffix (e.g.,~/.claude/settings.json.bak). - Precisely writes / deep-merges the gateway-related configuration while leaving your other settings untouched.
- Refreshes the UI status to show the current takeover state.
Stopping takeover also uses "precise removal": only when the configuration actually points to this gateway will the corresponding keys be removed, preventing accidental deletion of other settings you configured manually; it also revokes the virtual key automatically created during takeover.
Takeover Status
On the AI Gateway → Access Management → Clients page, each tool displays one of four statuses:
| Status | Meaning |
|---|---|
| Taken over (this gateway) | The tool points to the local AI Gateway |
| Connected (other address) | The tool is configured with another address (manually configured by you or pointing to another gateway); the gateway will not overwrite it on its own |
| Not taken over | The tool is detected but does not yet point to the gateway |
| Not detected | The tool's configuration directory was not found on this machine |
Prerequisites
- You are signed in to your ServBay account and have configured at least one available channel on the Channels page.
- The target AI tool is installed on this machine (the gateway determines its presence based on its configuration directory).
One-Click Takeover Procedure
Go to the AI Gateway → Access Management → Clients page, find the target tool in the tool list, and click One-Click Takeover. After successful takeover, the status becomes "Taken over (this gateway)". To undo it, click Stop Takeover.
Takeover Details by Tool
The table below lists the configuration files and content actually modified for each tool during takeover, so you can understand and troubleshoot.
| Tool | Configuration File | Content Written | Gateway URL |
|---|---|---|---|
| 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 |
| 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 definitions | http://127.0.0.1:11580/v1 |
| CodeBuddy | ~/.codebuddy/models.json | Deep-merge the servbay model node | http://127.0.0.1:11580/v1 |
| opencode | ~/.config/opencode/opencode.json | Deep-merge the provider.servbay node (aggregates models from all channels) | http://127.0.0.1:11580/v1 |
| Crush | ~/.config/crush/crush.json | Deep-merge the providers.servbay node | http://127.0.0.1:11580/v1 |
Why Claude Code's URL does not include /v1
Claude Code uses the Anthropic protocol, and the gateway appends paths such as /v1/messages on its own. Therefore, ANTHROPIC_BASE_URL must be the gateway root URL (without /v1). Most other tools use the OpenAI-compatible protocol and require the /v1 suffix. One-click takeover fills this in automatically according to each tool's convention, so you do not need to distinguish manually.
Restore and Troubleshooting
- Restore the original configuration — Click Remove, and the gateway precisely removes the configuration pointing to this gateway. You can also manually restore using the
.bakbackup file in the same directory. - Status shows "Connected (other address)" — This means the tool currently points to another address (manually configured by you or pointing to another gateway). To avoid overwriting your settings, the gateway will not take over automatically; you can manually clean up that configuration first and then take over.
- The tool still reports errors after takeover — Confirm that the gateway proxy service is running, the corresponding channel is healthy, and the virtual key has not been revoked. You can also check the Statistics and Monitoring page to see whether requests are reaching the gateway.
Frequently Asked Questions (FAQ)
- Q: Will one-click takeover damage my existing tool configuration?
- A: No. The gateway only precisely writes/merges keys related to the gateway and backs up the original file as
.bakbefore writing. Other settings remain unchanged.
- A: No. The gateway only precisely writes/merges keys related to the gateway and backs up the original file as
- Q: Can I manually change it back after takeover?
- A: Yes. Click Remove to have the gateway undo it, or manually restore from the
.bakbackup.
- A: Yes. Click Remove to have the gateway undo it, or manually restore from the
- Q: Where is the virtual key used for takeover?
- A: The gateway automatically creates a dedicated virtual key for each tool under takeover. You can view and manage them on the Keys page.
- Q: The tool shows "Not detected" in the list?
- A: This means the tool's configuration directory was not found on this machine. Please install and run the tool once so it generates its configuration directory, then take over.
Summary
One-click takeover simplifies the tedious and error-prone task of manually editing each tool's configuration file into a single click: automatic key creation, automatic backup, precise writes, and restore at any time. Combined with unified channel and usage statistics, you can have all your AI coding tools share the same provider configuration and cost view. If you want to call the gateway from your own code, see Endpoints and Environment Variables.
