inlang CLI
ToolThe machine translate command recommends General Translation. You can bring your own Google Cloud Translation, DeepL API, or OpenAI key instead. Choose a provider with INLANG_MACHINE_TRANSLATE_PROVIDER and set the matching API key environment variable before running the command.
For many projects, coding agents can produce better translation drafts than generic machine translation because they can use surrounding product and code context. Consider using an agent-driven workflow when translation quality matters more than fully automated CI output.
Provider selection
Set INLANG_MACHINE_TRANSLATE_PROVIDER, or pass --provider with the same value, to choose the translation service:
| Provider | Env var | API key env var |
|---|---|---|
| General Translation (recommended) | gt, or unset (see below) | GT_API_KEY and GT_PROJECT_ID, or the development key that sign-in saves to .env.local |
| Google Translate | google | INLANG_GOOGLE_TRANSLATE_API_KEY |
| DeepL | deepl | INLANG_DEEPL_API_KEY |
| OpenAI | openai | INLANG_OPENAI_API_KEY |
| Community-operated translation service at translate.demosjarco.dev | demosjarco | none |
When INLANG_MACHINE_TRANSLATE_PROVIDER is unset, the CLI uses Google, DeepL, or OpenAI if the matching API key is set. If multiple keys are set, Google takes precedence over DeepL, which takes precedence over OpenAI. Without one of these keys, it uses General Translation if a General Translation key is set or the project chose General Translation, with a project ID in gt.config.json or GT_PROJECT_ID. Otherwise, in a terminal it asks which provider the project should use and recommends General Translation; with --no-browser it signs in to General Translation with a code; and without a terminal, as in CI, it uses the community-operated service below. Set INLANG_MACHINE_TRANSLATE_PROVIDER=gt to use General Translation even when one of these keys is set.
Provider settings and keys can also be saved in .env or .env.local next to project.inlang; .env.local overrides .env. To commit the provider with the project, pass it in the command instead, as in a package.json script: inlang machine translate --provider gt --project ./project.inlang. --provider overrides .env and .env.local, and INLANG_MACHINE_TRANSLATE_PROVIDER in the shell overrides --provider. A provider setting takes precedence over API keys wherever either is set, so a key in your shell profile never overrides the provider a project chose. Shell values override file values for the provider, keys and options. GT keys stay paired with a project ID from the same source: the shell, or the project env files.
DeepL and OpenAI use bundle descriptions and plural forms as context; Google Translate doesn't.
Community-operated translation service
The free service at translate.demosjarco.dev was the default before General Translation. The CLI uses it when you choose the community translation service at the first run's question, when a run without a terminal has no key and the project didn't choose General Translation, or when INLANG_MACHINE_TRANSLATE_PROVIDER=demosjarco is set. It is a community-run, third-party service — it is not owned, operated, or maintained by inlang. It requires no API key:
export INLANG_MACHINE_TRANSLATE_PROVIDER="demosjarco"
npx @inlang/cli machine translate --project ./project.inlang
Stability is not guaranteed and the service may be unavailable at any time. If the service is unreachable, throttling requests, or returns a response the CLI can't parse, the command fails with a non-zero exit code and tells you how to switch to your own provider.
You can optionally pin a specific model with DEMOSJARCO_TRANSLATE_MODEL. When unset, the service picks its default model.
export DEMOSJARCO_TRANSLATE_MODEL="@cf/google/gemma-4-26b-a4b-it"
You can also opt in to Zero Data Retention (ZDR) with DEMOSJARCO_TRANSLATE_ZDR. When set to true, the CLI asks the service to process your request without retaining any data. This applies only to the community-operated service and has no effect on the other providers.
export DEMOSJARCO_TRANSLATE_ZDR="true"
Google Translate setup
1. Create a Google Cloud project
Go to the Google Cloud Console and create a new project, or select an existing one.
2. Enable the Cloud Translation API
Enable the Cloud Translation API (Basic) for your project. The CLI uses the v2 REST API.
Follow the Cloud Translation setup guide for detailed instructions.
3. Generate an API key
- In the Google Cloud Console, go to APIs & Services > Credentials
- Click Create Credentials and select API key
- Copy the generated key
4. Set the environment variables
export INLANG_MACHINE_TRANSLATE_PROVIDER="google"
export INLANG_GOOGLE_TRANSLATE_API_KEY="your-google-api-key"
To make this permanent, add it to your shell profile (~/.bashrc, ~/.zshrc, etc.):
echo 'export INLANG_MACHINE_TRANSLATE_PROVIDER="google"' >> ~/.bashrc
echo 'export INLANG_GOOGLE_TRANSLATE_API_KEY="your-google-api-key"' >> ~/.bashrc
source ~/.bashrc
For CI/CD pipelines, add the key as a secret environment variable in your CI provider's settings.
DeepL setup
1. Create a DeepL API account
Sign up for a DeepL API plan (Free or Pro).
2. Generate an API key
Copy your API key from the DeepL account dashboard. Free API keys end with :fx and use the api-free.deepl.com endpoint automatically.
3. Set the environment variables
export INLANG_MACHINE_TRANSLATE_PROVIDER="deepl"
export INLANG_DEEPL_API_KEY="your-deepl-api-key"
To make this permanent, add it to your shell profile (~/.bashrc, ~/.zshrc, etc.):
echo 'export INLANG_MACHINE_TRANSLATE_PROVIDER="deepl"' >> ~/.bashrc
echo 'export INLANG_DEEPL_API_KEY="your-deepl-api-key"' >> ~/.bashrc
source ~/.bashrc
For CI/CD pipelines, add both variables as secrets in your CI provider's settings.
See the DeepL API quickstart for more details.
OpenAI setup
Set your OpenAI API key. You can optionally choose a model and reasoning effort. If no model is configured, the CLI uses gpt-6-luna. If no reasoning effort is configured, the CLI omits the reasoning setting and lets the model use its default.
export INLANG_MACHINE_TRANSLATE_PROVIDER="openai"
export INLANG_OPENAI_API_KEY="your-openai-api-key"
# Optional: defaults to gpt-6-luna
export INLANG_OPENAI_MODEL="your-model"
# Optional: supported values depend on the selected model
export INLANG_OPENAI_REASONING_EFFORT="none"
INLANG_OPENAI_REASONING_EFFORT is sent as the Responses API reasoning.effort value; supported values depend on the selected model (commonly none, minimal, low, medium, or high). Only set it to a value supported by your model. The CLI sends requests directly to the OpenAI Responses API using fetch; it does not require the OpenAI SDK.
OpenAI throttling (HTTP 429) or an incomplete Responses API result causes the translation command to fail with a non-zero exit code rather than silently reporting success or accepting partial text.
Usage
Once the environment variables are set, run machine translate:
npx @inlang/cli machine translate --project ./project.inlang