AgentKit
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, uptime

Flags

FlagDescription
-h, --helphelp for api
--jsonEmit machine-readable JSON (implies --no-interactive)
--no-interactiveDisable interactive prompts (CI-safe)
-q, --quietSuppress non-error output on stderr
-V, --verboseExtra diagnostic output on stderr (loses to --quiet)
-y, --yesAssume yes for all prompts

Output modes

ModeBehavior
prettydefault on TTY (colors, ASCII markers)
plainauto when stdout piped or --no-interactive
json--json (single-object envelope, NDJSON-safe)

Exit codes

CodeMeaning
0success
1runtime error
2invalid flags
3user-cancel (SIGINT, prompt-cancel)
1runtime error (config I/O, listen failure)
2invalid flags or arguments
7security violation: non-loopback bind without auth token

On this page