AgentKit
ReferenceCLI commands

CLI commands

ak api

Run a local API + proxy server for AgentKit

ak api

Run a local API + proxy server for AgentKit

Synopsis

What it does: 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.

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.

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

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

What changes on disk: Reads ~/.agentkit/config.yaml for API keys. Writes ~/.agentkit/api/state.json on start; removes it on stop.

Output modes: pretty default on TTY (colors, ASCII markers) plain auto when stdout piped or --no-interactive json --json (single-object envelope, NDJSON-safe)

Exit codes: 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

Options

  -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

SEE ALSO

On this page