One gateway for WorkBuddy, Qoder, Cline, and Grok Build.
English | 简体中文
API Console is a self-hosted AI API gateway written in Go. It connects multiple upstream accounts to a shared API, with a built-in web console for authorization, account management, model discovery, API keys, and operations monitoring.
Applications can use Claude Messages, OpenAI Chat Completions, or Responses endpoints. The unified /v1 entry routes requests by model; channel-specific entries give you explicit control over the upstream provider.
- Four Upstream Channels — WorkBuddy, Qoder, Cline, and Grok Build OAuth, with official authorization flows in the console.
- Compatible API Interfaces — Messages, Chat Completions, and Responses, including streaming, reasoning, and tool calls where supported by the upstream model.
- Account Pool Scheduling — Weighted selection, concurrency limits, credential refresh, cooldowns, and retry policies.
- Model Discovery — Refresh catalogs from authorized accounts and manage model visibility and routing.
- API Key Management — Create and rotate keys with model permissions, expiry, request limits, concurrency limits, and usage budgets.
- Operations Dashboard — Request rates, latency, time to first token, channel and model views, runtime information, and alert rules.
- Logs and Diagnostics — Inspect requests, upstream attempts, errors, optional diagnostic captures, and management audit logs.
- Embedded Web Console — Responsive light and dark themes, packaged inside the Go binary without a separate frontend build.
- Release Updates — Version checks and guarded online upgrades with rollback on eligible Linux systemd deployments.
| Channel | Authorization | API prefix |
|---|---|---|
| WorkBuddy | Official browser authorization | /workbuddy/v1 |
| Qoder | Official device authorization | /qoder/v1 |
| Cline | WorkOS device authorization | /cline/v1 |
| Grok | Build OAuth device authorization | /grok/v1 |
| Unified routing | Gateway API key; routes by model | /v1 |
Grok uses the Build OAuth CLI upstream. Available models and capabilities depend on the authorized accounts and their upstream entitlements. Catalog refresh failures preserve previously observed models rather than substituting a built-in model list.
| Component | Technology |
|---|---|
| Backend | Go 1.26.6+, HTTP handlers, provider adapters |
| Frontend | Go templates, HTML, CSS, vanilla JavaScript |
| Storage | Redis for accounts, configuration, API keys, response state, and operational data |
| Packaging | Single binary with embedded web assets |
| Host deployment | Linux, systemd, and a reverse proxy such as Caddy |
- Go 1.26.6+, as specified in go.mod.
- A running Redis instance.
- Network access to the upstream services you intend to use.
git clone https://github.com/zhangdailin/API-Console.git
cd API-Console
# Optional: start a local Redis instance with persistent storage.
docker run -d --name api-console-redis \
-p 127.0.0.1:6379:6379 \
-v api-console-redis:/data \
redis:7 redis-server --appendonly yes
cp config.example.json config.json
go run ./cmd/server -config ./config.jsonIf Redis is already running, skip the Docker command and set its connection details in config.json.
Windows PowerShell
After cloning the repository and starting Redis:
Copy-Item config.example.json config.json
go run ./cmd/server -config ./config.jsonTo build a standalone binary:
go build -o orchids-server ./cmd/server
./orchids-server -config ./config.jsonOn Windows, use go build -o orchids-server.exe ./cmd/server and run ./orchids-server.exe -config ./config.json.
Download the Linux amd64 binary, its SHA-256 checksum, and build metadata from GitHub Releases. Place the binary alongside a copy of config.example.json, renamed to config.json.
sha256sum -c orchids-server-linux-amd64.sha256
chmod +x orchids-server-linux-amd64
./orchids-server-linux-amd64 --version
./orchids-server-linux-amd64 -config ./config.jsonExisting build and deployment scripts retain the binary name orchids-server. The project is API Console, with the four channels listed above.
For a persistent Linux service, reverse proxy, and backend port protection, follow the host deployment guide. Review the deployment script's options with:
bash scripts/deploy-orchids.sh --help- Open http://127.0.0.1:3002/admin/.
- Sign in as
admin. Ifadmin_passis empty, the server prints a generated password in its startup logs. - Add an account through the channel's official authorization flow in Accounts.
- Refresh the channel's model catalog in Models and select an available model ID.
- Create an API key in the console and save the complete key when it is shown.
- Configure your application with the gateway URL, key, and model ID.
The default port and admin path can be changed in the configuration. Upstream login credentials belong to account authorization; client applications use gateway-issued API keys.
The console can check for release updates. Installing an update or rolling back requires an explicitly enabled, eligible Linux deployment running as root under a persistent systemd service outside a container. The upgrade flow verifies release artifacts and uses a watchdog to check the restarted binary.
See Online Upgrade for eligibility, configuration, and recovery steps. Back up persistent data before upgrading; binary rollback does not restore Redis data.
Use http://127.0.0.1:3002/v1 for automatic model routing, or replace /v1 with a channel prefix.
| Method | Path relative to the API prefix | Purpose |
|---|---|---|
GET |
/models |
List visible models |
GET |
/models/{id} |
Retrieve model information |
POST |
/messages |
Claude Messages-compatible inference |
POST |
/chat/completions |
OpenAI Chat Completions-compatible inference |
POST |
/responses |
Responses-compatible inference |
Grok uses a native Build Responses path; the other channels bridge Responses through Chat Completions. See the capability matrix for channel and model limitations.
curl http://127.0.0.1:3002/v1/models \
-H 'Authorization: Bearer <API_KEY>'Replace <API_KEY> with a key created in the console and <MODEL_ID> below with an ID returned by the model catalog.
curl http://127.0.0.1:3002/v1/chat/completions \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{"model":"<MODEL_ID>","messages":[{"role":"user","content":"Hello!"}],"stream":true}'curl http://127.0.0.1:3002/v1/messages \
-H 'x-api-key: <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{"model":"<MODEL_ID>","max_tokens":256,"messages":[{"role":"user","content":"Hello!"}]}'curl http://127.0.0.1:3002/v1/responses \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{"model":"<MODEL_ID>","input":"Hello!","stream":true}'Response resources, input history, cancellation, token estimation, and compaction are documented in the API reference. Local cancellation of an ownership-only response record does not cancel upstream generation.
- Configuration precedence — Redis configuration at
<redis_prefix>settings:configcan override the local configuration file. Check effective values in the console after making changes. - Credential backups — Back up Redis together with the credential encryption key, normally
data/credential.key. Losing the key prevents existing account credentials from being decrypted. - API authentication — Model and inference endpoints require a managed API key.
inference_auth_enabled=falsedoes not disable authentication; only explicitly allowedanonymous_allow_ipssources are exempt. - Network access — Use a strong admin password, disable
debug_enabledin production, restrict/metricsand the backend port, and trust only your actual reverse proxy addresses. - Monitoring scope — Latency percentiles use retained samples. Collection health and diagnostic coverage are exposed separately so missing data is not presented as healthy zero traffic.
curl http://127.0.0.1:3002/healthgo test ./...
go vet ./...
node --test web/*.test.cjs
go build -o orchids-server ./cmd/serverNode.js is used for frontend tests; the application does not require a Node.js runtime or a frontend build step.
The detailed guides below are currently written in Chinese.
| Guide | Contents |
|---|---|
| API Reference | Inference routes, management APIs, authorization, and error responses |
| Configuration | Configuration fields, precedence, proxies, and credential storage |
| Architecture | Routing, provider adapters, storage, and model discovery |
| Protocol Capabilities | Channel capabilities and verification boundaries |
| Host Deployment | Linux examples, reverse proxy, and network protection |
| Deployment Notes | Backups, multiple instances, and validation |
| Online Upgrade | Release verification, upgrades, rollback, and recovery |
Issues and pull requests are welcome. Include reproduction steps for bug reports, and run the relevant checks before submitting a change. Keep upstream behavior claims separate from local test results.