Command reference#

Manage a running gateway through its management endpoints with a token, such as an admin key: API keys, budgets and spend, people, workspaces, models, observability and the audit log. Run any command with --help, or schema --json for every command at once. To administer a gateway's own store on its machine, without the server, see tokedex-gateway --help.

Each page here is built from the same schema as tdx <command> --help; tdx <command> --help --json prints it as JSON.

Command groups#

CommandDescriptionType
tdx adminInspect gateway administration capabilities.Group
tdx alert-channelsAlert destinations and Slack setup (dashboard only).Group
tdx alertsRead and mark spend alerts in your inbox.Group
tdx apiSend an admin HTTP request.Read or write
tdx api-keysManage API keys (tokedex_ik_).Group
tdx auditRead and follow the audit log (the dashboard's Events tab).Group
tdx authSign in with the browser or a token, and manage saved profiles.Group
tdx budgetsManage spend budgets.Group
tdx completionGenerate shell completion.Local
tdx configInspect compiled gateway configuration.Group
tdx doctorCheck connection, auth, catalogue and backend information.Read
tdx guidePrint bundled agent getting-started material.Local
tdx identity-settingsInspect sign-in and session settings.Group
tdx invitesManage one-shot invitation links.Group
tdx limitsRead the calling API key's budgets and rate limits.Read
tdx modelsModels callers can request from this gateway.Group
tdx observabilityRead inference traces and calls, the store status and its switch.Group
tdx openPrint or open the logged-in host dashboard.Write
tdx pricingInspect prices and manage price overrides.Group
tdx profileYour own gateway account profile (not a local connection profile).Group
tdx providersManage provider credentials.Group
tdx schemaPrint the command tree.Local
tdx sessionsInspect sessions; interactive revocation is unavailable.Group
tdx spendRead spend counters and settlements.Group
tdx sso-providersInspect SSO (OIDC sign-in) providers.Group
tdx usageRead usage reports.Group
tdx usersManage people and their role assignments.Group
tdx workspacesManage workspaces, their policy and spend.Group

Global flags#

Every command takes these flags.

FlagTypeDefaultDescription
-h, --helpbooleanfalseShow help; runs nothing.
--versionbooleanfalsePrint the CLI version; reads no profile, credential or host.
--hosturlGateway address: an HTTPS origin, or HTTP on localhost, 127.0.0.1 or [::1]. Also read from TOKEDEX_HOST.
--profilestringdefaultProfile: 1-64 lowercase ASCII letters, digits, dots, underscores or hyphens; start with a letter or digit. Also read from TOKEDEX_PROFILE.
--jsonfield-listPrint versioned JSON; optionally keep only these comma-separated fields of data.
--jqstringFilter the masked JSON with your installed jq; requires --json. A command that is not a read checks that the filter compiles before it sends anything. A filter that fails after a write exits 1 with CHANGE_APPLIED_JQ_FAILED and the unfiltered JSON on stdout: the change was applied. Under --dry-run the same failure is PREVIEW_JQ_FAILED, with nothing applied.
--dry-runbooleanfalseShow what a write would send without sending it; reads still run.

Environment variables#

VariableDescription
TOKEDEX_HOSTGateway address; --host takes precedence.
TOKEDEX_PROFILEProfile name; --profile takes precedence.
TOKEDEX_TOKENToken for this run only, such as an admin key; requires --host or TOKEDEX_HOST; never printed, and saved only by auth login.
XDG_CONFIG_HOMEExisting absolute directory whose tokedex/ folder holds saved profiles; unset, $HOME/.config is used (HOME must exist).
HTTP_PROXYAlways honored for HTTP and as HTTPS fallback without Node proxy opt-in; lowercase http_proxy takes precedence.
HTTPS_PROXYAlways honored for HTTPS regardless of NODE_USE_ENV_PROXY or NODE_OPTIONS; lowercase https_proxy takes precedence.
NO_PROXYDirect-host exclusions for CLI transport, independent of Node proxy opt-in; lowercase no_proxy takes precedence.

Exit codes#

CodeMeaning
0success
1internal
2usage
3authentication
4forbidden
5not found
6conflict
7unavailable

Output and errors#

A command that succeeds prints one JSON object to stdout, {"schemaVersion": "tokedex.cli.v1", "command": …, "data": …}, and exits 0. Help printed with --help --json uses tokedex.cli-help.v1. A command that fails prints {"error": {"code": …, "hint": …, "fix": …}} to stderr and exits with one of the codes above. Scripts and agents shows how to read both.

Shared behaviour#

Many commands behave the same way in these respects. Their sections link here instead of repeating the text.

Masked read output#

Secrets in the output are masked, judged against the whole request and gateway reply, before --json selects fields or --jq runs; █ marks a masked value. Checked booleans, values the CLI sets itself and its source field (where present) print unmasked; source is only checked to exclude the token. A reply that exceeds the masking limits fails with OUTPUT_MASK_LIMIT (exit 7) and prints no values.

Masked write output#

Secrets in the output are masked, judged against the whole request and gateway reply, before --json selects fields or --jq runs; █ marks a masked value. Checked booleans, values the CLI sets itself and its source field (where present) print unmasked; source is only checked to exclude the token. The request is masked on its own first; if it exceeds the masking limits, the command fails with OUTPUT_MASK_LIMIT (exit 7) and sends nothing. A --dry-run preview has no reply, so it is masked against the request and TOKEDEX_TOKEN (when set) only. If the gateway accepts a write but its reply exceeds the limits, the command exits 1 with its applied-but-invalid error and prints no values; a preview that exceeds them fails with OUTPUT_MASK_LIMIT (exit 7).

Checked request values#

Values you pass are checked against TOKEDEX_TOKEN (when set) and the gateway's token prefixes; under --dry-run a token saved only in a profile cannot be compared, because the profile is not read.

Values too long to print#

A value the CLI cannot print safely is withheld on its own and the rest of the reply still prints: text longer than 4096 characters, such as a tag, title, project, agent name or a client-chosen id, prints as [withheld: too long], and a trace, trajectory or request id containing a control character such as a TAB prints as [withheld: control character]. Masking still sees the full value. A withheld id cannot be looked up. A client can also send the marker text itself, which then reads the same as a withheld value.

People and role commands#

Every value in the reply is masked before --json, --jq or any other output, and masking fails closed; a secret under an ordinary-looking name cannot be recognised. Under --dry-run a write shows its method, path and body with no diff, unchecked by the gateway, and sends no request, reads no credential or profile and writes no file. Invalid input is refused before anything happens. The gateway still decides permissions, which roles you may grant and which people an identity provider owns; changes to admin-level people need a dashboard session with a fresh sign-in, which this token-only CLI cannot provide. The CLI never escalates or retries.

The gateway reveals a raw invitation URL once. Reserve a NEW owner-only 0600 --token-file before minting; existing files are never overwritten. The file contains the complete invitation link, never stdout, JSON, jq, hints or previews. Alternatively --secretless explicitly discards that link locally: the gateway still mints it, and no secretless field is sent. Masked or malformed links are never reported as delivered. Delivery failure or an uncertain write requires private state inspection, never blind repetition; no credential fallback is printed. See People and role commands.

Workspace reads#

Uses auth status host-bound bearer rules; the gateway decides what this credential may read, and the CLI enforces no permission itself. --dry-run still performs this read. See Masked read output. Key ids and names, an access review's key summaries, and budget, rate and lifetime settings in the gateway's own shapes print in clear unless they show too much of a token body. Other values the reply carries under key-like names (such as the source guardrail of a limit the guardrail sets, which masks key-preview adjustment reasons naming it) are learned as aliases, so matching public values may print as █ too. See Checked request values.

Workspace changes#

Uses auth status host-bound bearer rules; the gateway authorizes and validates every change, and the CLI enforces no permission itself. Only the options you supply are sent. Structured inputs are inline JSON options, never files or stdin, whose object keys must be the gateway's field names for that option: a layer's models, maxKeyLifetimeDays, keyRpmMax and keyBudgetMax, and a budget's window and limit. Invalid local input is refused before any profile, credential or gateway access. --dry-run sends no request and reads no profile, credential, stdin or file; it shows only a local preview of the requested method, path and body, without current state, review or gateway checks. One request, never retried. See Masked write output. Outside a --dry-run preview, key ids and names, a review's key summaries, and budgets ({"window": day, week, month or total, "limit": a USD amount}) and rate and lifetime settings in the gateway's own shapes print in clear unless they show too much of a token body. Other values sent or returned under key-like names (such as a budget in any other shape, or the source guardrail of a limit the guardrail sets, which masks the review kind) are learned as aliases, so matching public values may print as █ too. A --dry-run preview shows --key-budget-default and a layer's keyBudgetMax, and any string a layer holds under a key-like name, as █; a layer's number and null limits usually print as sent, but a number sharing digits with a whole-number budget limit prints as █ (write limits with a decimal point). See Checked request values.

Catalogue reads#

Uses auth status host-bound bearer rules. The response shape is checked, then recursively masked like api output, so fields named like token, key, secret or credential (for example contextWindowTokens) are intentionally shown as █. Gateway error bodies are never displayed; --dry-run performs the same read.

Catalogue changes#

Input, including any definition file, is validated before any profile or gateway access. --dry-run reads only an explicit definition file, sends no request, reads no profile or credential and creates nothing; it shows the masked requested method, path and body, unchecked by the gateway. A completed write prints the masked, shape-checked response; gateway error bodies are never displayed and nothing is retried. Ids and other public values are 1-512 characters without control or format characters, line separators or whitespace at either end; an --id is also never . or .., and is percent-encoded into the route. See Checked request values.

Catalogue republishing#

The gateway republishes the catalogue for this change, which can take several seconds on a large catalogue; the request deadline is 30 seconds, and a timeout means the outcome is unknown.

Observability filters and output#

Filter values are at most 512 characters without control characters and are refused before any request if they contain the bearer or a registered gateway token prefix; they are never echoed. Only supplied filters are sent. Output is a validated projection under fixed names; anything unexpected in the reply fails with INVALID_RESPONSE. Values pass the same fail-closed masking as api, with aliases learned from the request and the whole raw reply, dropped fields included; masked values print as █. Key metadata in the gateway's own forms prints in clear as JSON fields: ULID key ids (keyId), key labels (master key, virtual key and 6 lowercase hex digits, or a key id), key fingerprints (key_ and 16 lowercase hex digits), key kinds, key display names (keyName), key directories as calls list describes, the key lists and counts of an access review in the gateway's exact summary shapes, whose entries are judged by their own field names, and key budget, rate and lifetime settings. Where a command offers --key-id, a ULID key id prints in its own request path; a key-like query parameter or name=value text anywhere else is secret. When the request, whole raw reply and output of one command together show more positions of a known or learned gateway token's random body than leave 128 bits unseen with its checksum known, 17 or more for tokedex_ik_, tokedex_mk_, tokedex_ss_, tokedex_iv_ and tokedex_rs_ tokens and 22 or more for tokedex_vk_ tokens, each position counted once and only in runs of 8 or more consecutive characters, also when spaces or other separators split a run, every value showing any of them prints as █, a key display name included. Pieces shorter than 8 characters are not counted, so this covers previews and accidental pastes, not a key deliberately split into short pieces. Any other string of 8 or more characters under a secret-like name, except an RFC 3339 timestamp or a gateway entity id, prints as █ wherever it appears; this over-masking is intentional. A cursor that masking would change is refused (INVALID_RESPONSE), because a masked cursor cannot be passed back. A reply too large to mask fails with OUTPUT_MASK_LIMIT (exit 7); retry with a smaller --limit. --dry-run still performs this read.

Alert output#

Output values pass the same fail-closed masking as api, with aliases learned from the request and the whole reply; masked values print as █. A key alert's gateway key id, its drill-down link (/spend/?…&spendKey=<id>) and its fallback link (/api-keys/?…&key=<id>) print in clear when the link names that alert's own key; only these commands vouch for those links, so the same parameters anywhere else, such as in api output or in a link naming another key, are secret. Public values may still be over-masked: a key id that is not a gateway key id is treated as a secret, so it and its links print as █, and once such an alert is on the page, links sharing any query part of 8 or more characters with its drill-down link (such as the month or by=model) may print as █ too. Body positions of a known or learned gateway token are counted across the whole page, every alert and nextCursor included, so once the page shows too many of one token's positions every alert value showing any of them prints as █ and a nextCursor showing any of them is refused; each alert keeps its own work budget, so a large valid page lists whole. nextCursor is not masked but is refused if it echoes the bearer or a learned alias. A reply too large to mask (for list, retry with a smaller --limit) or too deep to mask, or one carrying a malformed cursor, a credential prefix in its cursor or a link that is not origin-relative, is refused.

Audit event fields#

Each event is projected under fixed names: envelope ids, times, category, severity, source, node, scope, actor (kind, id, auth method; the credential id is withheld), correlation, resource, revisions, and data as an array of { field, value } from a fixed list of the gateway's data field names; unknown data fields and idempotency key hashes are withheld.

Sign-in settings output#

Every reply value, including booleans, integers, sync and discovery.state, is masked; only the CLI constant source (always file) is added back afterwards. Values are masked under neutral CLI names and printed under the gateway's field names, so passwordLogin, minPasswordLength and allowLocalPasswordForSsoUsers are not erased by name and normally print real values; a number that echoes a secret elsewhere in the reply prints as █.