CLI and agents
Installation and login
Install the TolkBot CLI to translate files directly from your terminal.
Install
Install TolkBot globally with your package manager:
npm install -g tolkbot
Or run it directly with npx without installing:
npx tolkbot --help
TolkBot requires Node.js 22.22.0 or later.
Authenticate
Log in to connect the CLI to your TolkBot account:
tolkbot auth login
This opens your browser for authentication. After confirming, a token is saved locally at ~/.tolkbot/token, readable only by your user.
Your token
The token is a session for you, not for a project or a machine. It lasts 30 days, and anything holding it can act as you in every organization you belong to: start translation runs that spend credits, and change or delete projects. Treat it like a password.
If it leaks, or a machine that holds it is gone, sign out every CLI session:
tolkbot auth logout --all
Or, from a browser, use Sign out all CLI sessions on your profile page. Either way, every CLI token issued until then is refused on its next call, on every machine and in every CI secret. Your dashboard session keeps working, and a new tolkbot auth login gets a token that works.
Removing someone from your organization also cuts their token off from it.
On a machine with no browser
If TolkBot can't launch a browser (a container, or a remote host over SSH), print the URL instead:
tolkbot auth login --no-browser
The browser you open it in must be able to reach the CLI's machine on localhost, so forward the callback port when working remotely.
Without a terminal, for example when an agent runs the command, TolkBot prints the URL and the verification code as plain lines as soon as it has them, so the agent can pass them to you.
Verify your session
tolkbot auth whoami
This displays your logged-in email, where the token came from, and how many days it has left. With --json, expiresAt and expiresInSeconds say the same.
Log out
tolkbot auth logout
Removes the token stored on this machine. The token itself stays valid until it expires, so a copy elsewhere, such as a CI secret, keeps working. To end every copy, use tolkbot auth logout --all (Your token).
If TOLKBOT_TOKEN is set in your environment, logging out does not deauthenticate the CLI — the environment variable still takes precedence. Unset it as well.
CI and headless environments
tolkbot validate runs offline and needs no token, so a CI step that only checks your translation files needs no setup:
# .github/workflows/translations.yml
- name: Validate translations
run: npx tolkbot validate
Commands that talk to TolkBot, such as translate, glossary and learnings, need a token. Interactive login needs a browser, so CI reads it from the environment instead:
- name: Check what needs translating
env:
TOLKBOT_TOKEN: ${{ secrets.TOLKBOT_TOKEN }}
run: npx tolkbot translate --dst fr --dry-run
Generate the token by running tolkbot auth login on your own machine, then copying the contents of ~/.tolkbot/token into your CI secret store. It is your session and lasts 30 days (Your token), so the secret needs refreshing about once a month.
Token resolution order
TolkBot uses the first token it finds:
| Priority | Source | Typical use |
|---|---|---|
| 1 | --token <token> | One-off runs, scripts |
| 2 | $TOLKBOT_TOKEN | CI, agents, containers |
| 3 | ~/.tolkbot/token | Your local machine |
The --token flag works with every command, before or after it:
tolkbot --token "$MY_TOKEN" translate --dst fr
A token lasts 30 days. In its last 3 days, every command prints a one-line warning on stderr; --json output on stdout is unchanged. When it runs out, TolkBot says so and tells you which source it came from, rather than failing with an opaque authentication error. Re-run tolkbot auth login and refresh your CI secret.
Output for scripts and agents
Without a terminal, as in CI or when a coding agent runs a command, nothing prompts and every command that has --json prints JSON. A failure prints one error shape on stderr, and the exit code says what kind of failure it was. The codes, and what an agent runs after adding a string, are on For agents.
What's next
- Set up a project with
tolkbot init - Start translating with
tolkbot translate - Every command, with its options and output
Telemetry
The CLI reports anonymous usage so we know which commands are used and which fail. Each run sends one event with the command name (for example jobs apply), whether it succeeded, how long it took, and the CLI, Node.js and operating system versions. It never sends arguments, file paths, file contents, translation strings or repository names.
When you are logged in, the event is tied to your account so it lines up with what you do in the dashboard. Otherwise it uses a random identifier stored in ~/.tolkbot/anonymous-id.
Turn it off on a machine:
tolkbot telemetry off
Or with an environment variable, which also works in CI and overrides the stored preference:
TOLKBOT_TELEMETRY=0 tolkbot validate
The CLI also honours the DO_NOT_TRACK convention. tolkbot telemetry status shows the current state and which setting decided it.