2.4.1-beta.1) — updated automatically on every beta release.Switch to stable →CLI commands
ak api start
Start the local API + proxy server
Start the AgentKit local API and proxy server. The server listens on 127.0.0.1 by default (loopback-only). Non-loopback binds require --auth-token for security. State is written to ~/.agentkit/api-state.json so ak api stop and ak api status can find the running process.
Who it's for: Power devs integrating the local API into scripts or other tools; non-technical users via the matching dashboard surface.
When to use it: When you need the AgentKit proxy API running for local tool integrations, dashboards, or automated pipelines. Use ak api status to check if already running.
What changes on disk: Writes ~/.agentkit/api-state.json with PID, bind address, and start time. File is removed by ak api stop.
Usage
ak api start [flags]Examples
ak api start # default loopback, port 8765
ak api start --port 9000 # custom port
AK_API_TOKEN=<secret> ak api start --bind 0.0.0.0 # non-loopback via env (preferred)
ak api start --bind 0.0.0.0 --auth-token @/run/secrets/ak-token # token from file
ak api start --json # emit startup envelope as JSONFlags
| Flag | Description |
|---|---|
--auth-token string | Bearer token for request auth (required when --bind is non-loopback; env: AK_API_TOKEN). Prefix with @ to read from a file: --auth-token @/path/to/token. Prefer the AK_API_TOKEN env var to avoid secret exposure in process listings. |
--bind string | Bind address (default 127.0.0.1; non-loopback requires --auth-token) (default "127.0.0.1") |
-h, --help | help for start |
--json | Emit machine-readable JSON (implies --no-interactive) |
--no-interactive | Disable interactive prompts (CI-safe) |
--port int | Port to listen on (0 = OS-assigned) (default 8765) |
-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) |
7 | non-loopback bind attempted without --auth-token (security violation) |
Related commands
ak api— Run a local API + proxy server for AgentKit