ReferenceCLI commands
BetaYou are reading docs for the beta channel (
2.4.1-beta.1) — updated automatically on every beta release.Switch to stable →CLI commands
ak api
Run a local API + proxy server for AgentKit
Start a local HTTP server that proxies Anthropic, OpenAI, and Gemini API requests, injecting auth headers from your AgentKit config. Also exposes read-only local endpoints: /health, /status, /version.
Once running, probe the read-only local endpoints: curl http://127.0.0.1:8765/health # {"ok":true} curl http://127.0.0.1:8765/status # process state, uptime, request count curl http://127.0.0.1:8765/version # binary version + build info
Who it's for: Power devs who want a shared local proxy, CI pipelines, desktop app backend.
When to use it: Use ak api start to bring up the server. It binds 127.0.0.1 by default. Non-loopback binds require --auth-token for security.
What changes on disk: Reads ~/.agentkit/config.yaml for API keys. Writes ~/.agentkit/api/state.json on start; removes it on stop.
Examples
ak api start # bind 127.0.0.1:8765 (default port)
ak api start --port 9000 # custom port
ak api start --daemon # run in background
ak api start --json # emit startup JSON for CI
ak api start --bind 0.0.0.0 --auth-token=tok # non-loopback with auth
ak api stop # stop the running daemon
ak api status # show PID, port, uptimeFlags
| Flag | Description |
|---|---|
-h, --help | help for api |
--json | Emit machine-readable JSON (implies --no-interactive) |
--no-interactive | Disable interactive prompts (CI-safe) |
-q, --quiet | Suppress non-error output on stderr |
-V, --verbose | Extra diagnostic output on stderr (loses to --quiet) |
-y, --yes | Assume yes for all prompts |
Output modes
| Mode | Behavior |
|---|---|
pretty | default on TTY (colors, ASCII markers) |
plain | auto when stdout piped or --no-interactive |
json | --json (single-object envelope, NDJSON-safe) |
Exit codes
| Code | Meaning |
|---|---|
0 | success |
1 | runtime error |
2 | invalid flags |
3 | user-cancel (SIGINT, prompt-cancel) |
1 | runtime error (config I/O, listen failure) |
2 | invalid flags or arguments |
7 | security violation: non-loopback bind without auth token |
Related commands
ak— AgentKit CLIak api start— Start the local API + proxy serverak api status— Show the running state of the API serverak api stop— Stop the running API server daemon