Docs

Get started

Token4AI CLI and agent automation

Authorize the CLI in your browser and automate wallet, key, usage and asset operations with JSON output.

Updated

Download and authorize

The customer command is token4ai. Use Vega’s CLI download endpoint for your platform: linux-x64, linux-arm64, darwin-x64 or darwin-arm64. Polaris is an operator tool and is not the customer CLI.

Linux x64
curl --fail --location https://dash.token4ai.cloud/api/cli/download/linux-x64 --output token4ai
chmod +x token4ai
./token4ai auth login --host https://dash.token4ai.cloud
auth login displays a browser authorization link and code. The account owner must sign in and approve before the CLI receives access.

Common commands

Use --json for machine-readable output and check the process exit code. agent manifest lists machine-readable capabilities and agent skill provides integration guidance. CLI management tokens are not model credentials for api.token4ai.cloud.

After adding token4ai to PATH
token4ai auth status
token4ai whoami --live --json
token4ai overview --json
token4ai wallet --json
token4ai key list --json
token4ai usage --page 1 --page-size 20 --json
token4ai announcements --json
token4ai agent manifest --json

Local coding agent setup

token4ai agent setup writes the Codex, Claude Code, Gemini CLI or OpenCode configuration with one command. It reuses an API key from the current account and creates one when missing; the key never appears in command arguments or output. Re-running is safe: the original file is backed up, unrelated fields are preserved, and --dry-run only prints the plan.

  • Codex and OpenCode use /v1; Claude Code and Gemini CLI use the bare root. setup reads the current gateway from /api/public-config and accepts --base-url.
  • OpenCode configs with comments are refused by default; use --force only when you accept losing comments. Gemini CLI and OpenCode keys are written to ~/.config/token4ai/agents/*.env (0600) and loaded through a managed shell-profile block.
One command per agent
token4ai agent setup --agent codex
token4ai agent setup --agent claude-code
token4ai agent setup --agent gemini-cli
token4ai agent setup --agent opencode

token4ai agent status --json
token4ai agent doctor --agent codex --live --json

Key tests and automation boundaries

Key tests call a model and may incur usage. Pass secrets through environment variables or standard input rather than ordinary command arguments. CI may use a previously authorized TOKEN4AI_ACCESS_TOKEN for the intended console account and host.

Run token4ai auth logout to revoke authorization when finished. Follow confirmation prompts for deletion and ensure automation understands the affected resource.

Key test
token4ai key test YOUR_KEY_ID --model YOUR_MODEL_ID --env TOKEN4AI_API_KEY

Related guides