Docs CLI

coding.sh gateway

LLM gateways: detect routing, enrich sessions with billed cost. Every option of coding.sh gateway and its subcommands, from its own --help.

coding.sh gateway --help
coding.sh gateway <action>

  LLM gateways: detect routing, enrich sessions with billed cost

Commands
  status        Show which agents route through a gateway, key sources and tagged sessions
  enrich        Attach billed cost and serving provider to llm calls with a gateway request id

Notes
  Keys come from each gateway's standard env var (AI_GATEWAY_API_KEY, OPENROUTER_API_KEY, LITELLM_PROXY_API_KEY, CLOUDFLARE_API_TOKEN, PORTKEY_API_KEY, HELICONE_API_KEY) or [gateway] / [gateway.<name>] apiKeyEnv / apiKey in config.toml, and are never printed or stored.
  Lookups use each gateway's per-request API (Vercel and OpenRouter /generation, LiteLLM /spend/logs, Cloudflare logs, Portkey logs, Helicone /v1/request); results are cached in the index, so re-runs make no calls.
  enrich --gateway cliproxyapi reads CLIProxyAPI's usage queue with its management key (CLIPROXYAPI_MANAGEMENT_KEY). The read removes the records for every other reader, so it runs only when named, never with --dry-run or --offline; coding.sh keeps each record it read until it joins a call.

coding.sh gateway status

Show which agents route through a gateway, key sources and tagged sessions.

coding.sh gateway status --help
coding.sh gateway status [options]

  Show which agents route through a gateway, key sources and tagged sessions

Options
  --gateway <NAME>  Only this gateway
  --credits         Also fetch the credit balance (Vercel, OpenRouter; needs the key)

Examples
  coding.sh gateway status
  coding.sh gateway status --gateway openrouter --credits

coding.sh gateway enrich

Attach billed cost and serving provider to llm calls with a gateway request id.

coding.sh gateway enrich --help
coding.sh gateway enrich [options]

  Attach billed cost and serving provider to llm calls with a gateway request id

Options
      --gateway <NAME>  Only this gateway
  -s, --session <ID>    Only this session (repeatable; or latest)
      --since <WHEN>    Sessions after this time: 7d, 12h, 30m, today or a date (local time) (default: 30d)
  -n, --limit <N>       Maximum rows (default: 500)
      --offline         Use only the cache and drained traces; no API calls
      --dry-run         Show the exact changes without writing anything
      --fresh           Wait for every pending capture to be ingested (default: answer after 1.5 s)

Examples
  coding.sh gateway enrich
  coding.sh gateway enrich --session latest --dry-run
  coding.sh gateway enrich --gateway openrouter

All commands · Global options