@babelize/cli
Babelize CLI — AI-powered i18n platform for managing translations from your terminal.
Install
npm install -g @babelize/cli
Quick start
In your project's folder:
npx babelize # or: npx @babelize/cli
It checks git (offering git init and a first commit, and warning about uncommitted changes), finds your framework, i18n library and source language on your machine, signs you in if needed (GitHub or Google in the browser, or email and password), asks which languages you want (remembered in .babelize/config.json), then writes locale files and i18n code for review with git diff. Signed in, no API key is needed: translation is billed in Babelize credits, and the summary shows how many were used.
When it's done, add a language switcher (ready-made ones at https://elements.babelize.co, or build your own). Run npx babelize again after changes: only new or changed text is translated. For pull requests instead, connect the repo at https://app.babelize.co or run babelize run start.
Without a terminal, pass the languages: babelize start --to fr,de --yes. (The interactive command menu is now babelize shell.)
With your own LLM key, or in CI
babelize translate is the same local translation with flags instead of questions. Use your own LLM key (no account needed), your signed-in session, or a Babelize API key:
export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY
npx babelize translate --to fr,de,ja
git diff
Or use Babelize-hosted translation: create an API key at https://app.babelize.co/api-keys (free tier included), then
export BABELIZE_API_KEY=bblz_sk_...
npx babelize translate --to fr,de,ja
- Frameworks: React, Next.js (App Router), Django and static HTML are supported. Vue and React Native (Expo and bare) are in beta.
- Key: the first LLM key found in the order above is used; with none,
BABELIZE_API_KEYselects Babelize-hosted translation, and with no key at all your signed-in session does (strings only, never code; billed in Babelize credits). Pick another with--provider(babelizefor hosted), or a different model with--model. - Output:
--jsonprints the QA report, which is also written to.babelize/local/report.json(--report <path>moves it). A run where some keys failed exits6unless--allow-partial. - Safety: it needs a git repo with a clean working tree (
--forceoverrides). It works on a temporary copy and touches nothing if the run fails.--dry-runprints the diff without writing. - Re-runs: commit
.babelize/local/babelize-lock.jsonand later runs only translate new or changed strings.
Full guide: https://docs.babelize.co/cli/translate
Quick Start (platform)
# Log in to your Babelize account
babelize auth login
# Initialize a new project
babelize init
# Start a translation run
babelize run start
Commands
| Command | Description |
|---|---|
(no command) / start | Translate the project in this folder, step by step (git, sign-in, languages) |
translate --to <locales> | Translate this repo locally: signed in, your own LLM key, or BABELIZE_API_KEY (writes to the working tree) |
check [path] | QA the locale files (missing keys, placeholders, ICU, plurals); exits 1 on errors, for CI |
shell | The interactive command menu |
init | Initialize a new Babelize project |
auth login / signup / logout / whoami | Authentication management |
auth reset-password | Send a password reset email |
auth provider-tokens | Manage OAuth provider tokens (GitHub, etc.) |
status | Check API health and your account status |
scan [directory] | Scan a local directory for hardcoded translatable strings |
projects | CRUD, sync, insights, metadata, download, brand-voice, archive |
run start / status / analyze | Translation pipeline engine (start supports --no-poll, --no-pr, --json) |
babels | View translation job history |
pr | GitHub PR integration |
billing | Plans, usage, invoices |
subscriptions | List plans, show the default plan and your current plan |
checkout | Purchase a plan |
languages | System and project-level language management, ISO ↔ FLORES-200 code conversion |
members | Team member management |
tm | Translation memory (owner-scoped, shared across your projects: view, add, update, export as TMX, clear) |
glossary | Translation glossary (list, add, update, delete, import, export) |
api-keys byok | BYOK provider keys (OpenAI, Anthropic, Groq, etc.) |
api-keys babelize | Babelize API keys (bblz_sk_ prefix for MCP/external access) |
comments | Translation comments and discussions |
notifications | Notification inbox |
analytics | Usage history, activity logs, audit logs |
account | MFA, sessions, account deletion |
privacy | GDPR data export and erasure |
admin | Platform administration (owner only) |
invitations | Team invitations |
roles | Role management |
users | User listing |
Run babelize <command> --help for subcommand details.
Shell Completion
Generate bash or zsh completion scripts:
babelize completion bash > /usr/local/etc/bash_completion.d/babelize
babelize completion zsh > /usr/local/share/zsh/site-functions/_babelize
The script dynamically reflects all registered commands at generation time.
Configuration
Credentials and preferences are stored at:
- macOS:
~/Library/Preferences/@babelize/cli-nodejs/config.json - Linux:
~/.config/@babelize/cli-nodejs/config.json - Windows:
%APPDATA%\@babelize\cli-nodejs\Config\config.json
The API URL resolves in this order:
--api-urlflag — per-command overrideBABELIZE_API_URLenv var — e.g.http://localhost:3001/apifor local dev- Stored config — the URL saved by
babelize auth login --api-url <url>or the "Self-hosted" login choice (localhost URLs included). A URL is only stored when you ask for it. - Default:
https://api.babelize.co/api
Environment Variables
| Variable | Description |
|---|---|
BABELIZE_API_URL | Override API URL |
BABELIZE_TOKEN | Auth token (alternative to babelize auth login or --token) — recommended for CI. Also used for signed-in translation |
BABELIZE_NON_INTERACTIVE | Force non-interactive mode (1 or true) |
CI | When set (not "false"), the CLI never prompts — missing flags exit with a usage error |
NO_COLOR | Disable colored output (any non-empty value) |
ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY | Your LLM key for babelize translate (first one set wins; --provider to choose) |
BABELIZE_API_KEY | Babelize API key (bblz_sk_…) for hosted translation in babelize start / babelize translate when no LLM key is set |
BABELIZE_TELEMETRY | 0 turns off anonymous usage data (DO_NOT_TRACK=1 works too). See Telemetry |
CI / Non-Interactive Mode
The CLI is CI-safe. Set CI=true (most pipelines do automatically), set BABELIZE_NON_INTERACTIVE=1, or pass --non-interactive / --yes, and the CLI will never block on a prompt. --yes also answers "yes" to confirmations such as deletes; without it, a confirmation in non-interactive mode fails with exit code 2:
CI=true babelize run start -p <project-id> -l es,fr --no-poll --json
In non-interactive mode, missing required flags exit with 2 (usage) and an actionable message instead of prompting. Closed stdin (non-TTY) is also treated as non-interactive.
Authenticate in CI with a token rather than a stored session:
export BABELIZE_TOKEN=bblz_sk_xxxxxxxx
For local translation in CI, set BABELIZE_API_KEY (or your own LLM key) and run npx babelize start --to fr,de --yes.
See the CI/CD docs for a full GitHub Actions recipe.
Exit Codes
| Code | Meaning | When it happens |
|---|---|---|
0 | Success | Command completed |
1 | Internal error | Unexpected failure |
2 | Usage error | Unknown command, bad flag, missing or invalid argument (e.g. a malformed ID), or a prompt that cannot be answered in non-interactive mode |
3 | Auth error | Not logged in, session expired, login failed, token rejected |
4 | Config error | No way to translate (no key and not signed in), unsupported project, no locale files for check |
5 | Network error | API unreachable, rate limited, DNS failure, timeout |
6 | API error | Server returned 4xx/5xx; a run that failed (run start, run status --watch) |
128 | Cancelled | Interactive prompt cancelled, or a run that was cancelled before it finished |
A cancelled prompt exits
128, never0— so a pipeline step can't silently pass when required input is missing.
Scripts can use these codes for conditional logic:
babelize run start --no-poll || exit_code=$?
if [ $exit_code -eq 3 ]; then
babelize auth login
fi
JSON Mode
Append --json to a command for machine-readable JSON output. Coverage is per
subcommand: where a subcommand doesn't implement it, --json is ignored and the
usual human-readable output is printed (e.g. babelize projects list --json
returns JSON, but some members and notifications subactions do not).
With --json, spinners and other progress output never touch stdout (errors and
notices go to stderr), so babelize --json auth whoami | jq works. When stdout is
not a terminal, spinners are replaced by plain lines on stderr.
Telemetry
The CLI sends anonymous usage data: the command, CLI/Node/OS version, framework, translator type, target locales, counts and whether the run succeeded. Never your code, strings, file names or account details. babelize check and --provider pseudo send nothing. A notice is printed the first time.
Turn it off with babelize telemetry disable, BABELIZE_TELEMETRY=0 or DO_NOT_TRACK=1. Details: docs.babelize.co/cli/telemetry.
Update Notifications
The CLI checks npm registry for new versions once per session (non-blocking). To update:
npm update -g @babelize/cli
Troubleshooting
| Problem | Solution |
|---|---|
Not authenticated | Run babelize auth login |
Directory not found on scan | Ensure the path exists and is a directory |
EPERM on install | Use sudo npm install -g @babelize/cli |
| Completion not working | Ensure the script is sourced: source /usr/local/etc/bash_completion.d/babelize |
| Rate limited | Wait 60 seconds and retry |
BABELIZE_API_URL not honored | Ensure the env var is set before running the command |