Skip to main content
twinbay wraps the same API the console uses. Source and per-command reference live in panoratech/twinbay-cli.
The CLI is pre-production. Pin a release in CI rather than tracking latest.

Install

Binaries for each platform are on the releases page. Check the install with twinbay version.

Authenticate

The CLI sends an organization API key. Mint one in the console under API keys, or with twinbay api-keys create --name ci.
Values resolve in this order:
  1. Flags: twinbay --organization-api-key <key> <command>
  2. Environment: CLI_TWINBAY_ORGANIZATION_API_KEY
  3. The OS keychain, written by twinbay auth login or twinbay configure
  4. ~/.config/twinbay/config.yaml
macOS Keychain, GNOME Keyring or KWallet, and Windows Credential Locker hold the secret. Without a keychain the CLI falls back to the config file. In CI, set the environment variable from your secret store. twinbay configure sets credentials and global preferences together, and twinbay whoami masks credential values while naming their source as [flag], [env], [keyring], [config] or [unset].

A run, end to end

Commands

twinbay explore opens an interactive browser over every command, its description and its flags, and runs the one you pick. Run twinbay <group> <command> --help for flags. Path parameters are flags: --sandbox-id, --sandbox-twin-id, --resource, --external-id. Body fields are flags too, so sandboxes create takes --name, --prompt, --twins, --template and --save-as-template, and sandboxes twins advance takes --at.

Request bodies

Commands that send a body accept three inputs. Individual flags win over --body, which wins over stdin.
--twins takes the JSON array the API takes, so a curated scenario rides along with the slug:
Record bodies go in --body-param, keeping --body free for the whole request:

Output

--output-format (-o) picks the rendering: pretty (default), json, yaml, table, and toon for Token-Oriented Object Notation, which costs 30 to 60 percent fewer tokens than JSON when a response goes into a prompt.
--jq (-q) applies a jq expression and always prints JSON, overriding --output-format. Under --all, output streams as it arrives: NDJSON for json, ----separated documents for yaml. Colors follow --color auto|always|never, plus NO_COLOR and FORCE_COLOR.

Inside a coding agent

--agent-mode returns structured errors and defaults the output to TOON. The CLI turns it on by itself when it detects an agent environment such as CLAUDE_CODE or CURSOR_AGENT, so an agent gets compact output without being told; pass --agent-mode=false to opt out. Add --no-interactive to shut off prompting, TUI forms and the explorer auto-launch in any non-tty context. For an agent that speaks MCP, the MCP server is the shorter path: the same operations arrive as tools, and the user signs in rather than passing a key.

Scripting

--dry-run prints the request the CLI would send to stderr and makes no network call. Exit code 0 means success and 1 means failure, with data on stdout and errors on stderr.
Also on every command: --debug (-d) for request and response diagnostics on stderr, --include-headers to keep response headers in the output, --header (-H) to add a request header, --timeout 30s, --server-url to point at another deployment, and --usage to print the command schema as KDL.

Shell completion