Glotto translates i18n JSON files (i18next, react-intl, vue-i18n, etc.) using AI providers without forcing the model to produce JSON. It walks the input JSON, extracts every string leaf with its path, sends them to the model as plain-text tagged batches, and reconstructs the JSON from the responses. The original structure, keys, arrays, variables and HTML tags are preserved by Glotto itself — the model only sees and produces text.
deno install --global --name glotto -A jsr:@ibodev/glottoOr run without installing:
deno run -A jsr:@ibodev/glottonpm install --global glottoOr via npx:
npx glottopnpm add --global glottoOr via pnpx:
pnpx glottoglotto --key <openai-api-key> -i en.json -o tr.json -f English -t Turkishglotto --key <gemini-api-key> -i en.json -o ar.json -f English -t Arabic -p geminiglotto --key <openai-api-key> -i en.json -o tr.json -f English -t Turkish -p openaiCustom base URL (e.g. self-hosted OpenAI-compatible server):
glotto --key <key> -i en.json -o tr.json -f English -t Turkish \
-p openai -m <model-name> --url <base-url>glotto --key <anthropic-api-key> -i en.json -o tr.json -f English -t Turkish -p anthropicglotto --key <key> -i en.json -o tr.json -f English -t Turkish -p openai -m <model-name>Pass comma-separated values to -t/--to and -o/--output. The two lists must have the same length; entries pair up by index.
glotto --key <key> -i en.json -f English \
-t "Turkish,French,German" \
-o "tr.json,fr.json,de.json"When --incremental is set and the target file already exists, Glotto compares it against the source and only sends keys whose target value is missing or
empty. The existing target structure is preserved; only the missing values are filled in.
glotto --key <key> -i en.json -o tr.json -f English -t Turkish --incrementalIf the target file does not exist, Glotto falls back to a full translation.
--stats prints input/output token totals, call counts, batch sizes and per-target breakdown after the run finishes. Off by default.
glotto --key <key> -i en.json -o tr.json -f English -t Turkish --statsYou can keep flags in a config file so you don't have to retype them. Glotto looks for glotto.config.json in the current working directory by default; pass
--config <path> to use a custom location. CLI flags always override config values.
Reference the JSON Schema for editor autocompletion and validation:
{
"$schema": "https://raw.githubusercontent.com/ibodev1/glotto/main/schema/glotto.schema.json",
"provider": "openai",
"model": "gpt-4.1-mini",
"input": "locales/en.json",
"from": "English",
"to": ["Turkish", "French", "German"],
"output": ["locales/tr.json", "locales/fr.json", "locales/de.json"],
"incremental": true,
"stats": true
}With this config you only need to provide the API key on the CLI:
glotto --key <key>glotto --key <key> -i en.json -o tr.json -f English -t Turkish --no-limit --no-timeout--max-batch-size is the maximum source bytes per batch, in KB. Smaller batches mean more requests but lower per-request token cost; larger batches mean fewer
requests.
glotto --key <key> -i en.json -o tr.json -f English -t Turkish --max-batch-size 8| Flag | Description |
|---|---|
--key |
API key for the chosen provider (required) |
-p, --provider |
gemini | openai | anthropic (default openai) |
-m, --model |
Model name (defaults: gpt-4.1-mini, gemini-2.5-flash, claude-3-5-haiku-latest) |
-i, --input |
Source JSON file (required) |
-o, --output |
Target JSON file path. Comma-separated for multi-target (required) |
-f, --from |
Source language |
-t, --to |
Target language. Comma-separated for multi-target |
--url |
Custom base URL for OpenAI/Anthropic |
--config |
Path to a config file (default: ./glotto.config.json if present) |
--stats |
Print AI usage stats (tokens, calls, bytes) at the end |
--incremental |
Translate only missing/empty keys when the target already exists |
--no-limit |
Skip the inter-batch rate-limit delay |
--no-timeout |
Disable request timeout |
--max-batch-size |
Max source bytes per batch in KB (default 12) |
-h, --help |
Help |
-v, --version |
Version |
glotto.config.json accepts the keys below. CLI flags override config values.
| Key | Type | Notes |
|---|---|---|
key |
string | API key |
provider |
openai | gemini | anthropic |
|
model |
string | |
input |
string | Source JSON path |
from |
string | Source language |
to |
string | string[] | Single target or array for multi-target |
output |
string | string[] | Must match to length when array |
url |
string | Custom base URL |
noLimit |
boolean | |
noTimeout |
boolean | |
maxBatchSize |
integer (KB) | |
stats |
boolean | |
incremental |
boolean |
Run from source:
deno task cli --key <key> -i en.json -o tr.json -f English -t TurkishBuild a single-file binary:
deno task buildBuild npm package:
deno task build:npmIf Glotto saves you time, consider giving it a ⭐ on GitHub — it really helps the project reach more people.
MIT © 2026