Configuration
Config file
Section titled “Config file”yaku stores configuration in a YAML file. Find its location with:
yaku config pathThe file is created automatically when you first run yaku config set. You can also edit it directly — yaku preserves comments and formatting.
All config fields
Section titled “All config fields”| Field | Type | Default | Description |
|---|---|---|---|
api-key | string | LLM API key for local backends (Gemini, OpenAI, Anthropic). | |
default-target | string | Default target language. Lets you omit --to. | |
backend | string | hosted | LLM backend: hosted, gemini, openai, anthropic. Validated on set. |
model | string | backend default | Model name override (e.g., gemini-2.5-flash, gpt-4o-mini). |
api-base | string | API base URL override for any local backend. Commonly used with OpenAI-compatible providers. | |
hosted-url | string | https://api.yakulang.com | Hosted service API endpoint. Auth endpoints are derived automatically (strips api. prefix). |
prompt | string | Path to a custom system prompt file. Applied to every translation. |
Example config file
Section titled “Example config file”api-key: AIzaSy...your-gemini-keydefault-target: enbackend: geminimodel: gemini-2.5-flashManaging config
Section titled “Managing config”# Set a valueyaku config set default-target zh-TW
# Read a value (from file only, ignores environment variables)yaku config get default-target
# Find the config fileyaku config pathEnvironment variables
Section titled “Environment variables”Environment variables override config file values. This is useful for CI/CD, containers, or switching between projects.
| Variable | Overrides config field | Example |
|---|---|---|
YAKU_API_KEY | api-key | export YAKU_API_KEY=AIza... |
YAKU_DEFAULT_TARGET | default-target | export YAKU_DEFAULT_TARGET=zh-TW |
YAKU_BACKEND | backend | export YAKU_BACKEND=openai |
YAKU_MODEL | model | export YAKU_MODEL=gpt-4o |
YAKU_API_BASE | api-base | export YAKU_API_BASE=https://api.groq.com/openai/v1 |
YAKU_HOSTED_URL | hosted-url | export YAKU_HOSTED_URL=https://api.staging.yakulang.com |
Environment variable override behavior
Section titled “Environment variable override behavior”When a YAKU_* environment variable is set — even to an empty string — it overrides the corresponding config file value. This prevents silent fallback when a key source fails:
# Explicitly empty → overrides config file, key becomes emptyYAKU_API_KEY="" yaku --backend gemini --to en "test"# Error: YAKU_API_KEY is set but empty (check your key source).Backend-specific API key fallbacks
Section titled “Backend-specific API key fallbacks”When YAKU_API_KEY is not set at all (not even to an empty string) and there is no api-key in the config file, yaku checks these backend-specific environment variables based on the resolved backend (including the --backend flag):
| Backend | Fallback variable |
|---|---|
gemini | GOOGLE_API_KEY |
openai | OPENAI_API_KEY |
anthropic | ANTHROPIC_API_KEY |
This means you can use existing environment variables from other tools (e.g., the Google Cloud SDK or OpenAI CLI) without additional configuration. Combined with --backend, you can switch between providers without changing your config:
export GOOGLE_API_KEY=your-gemini-keyexport OPENAI_API_KEY=your-openai-keyyaku --backend gemini --to en "Bonjour"yaku --backend openai --to en "Bonjour"Precedence order
Section titled “Precedence order”When the same setting is specified in multiple places, the highest-priority source wins:
- Command-line flag (highest) — e.g.,
--to ja - Environment variable — e.g.,
YAKU_DEFAULT_TARGET=ja - Config file —
~/.config/yaku/config.yaml - Built-in default (lowest)
Example: If your config file has default-target: en but you run yaku --to ja, the target language is ja.
Error handling
Section titled “Error handling”- Missing config file: yaku uses built-in defaults. No error.
- YAML syntax error: yaku logs a warning to stderr and continues with defaults.
- Unknown config key:
yaku config setrejects keys that are not in the list above. - Invalid config value:
yaku config setvalidates values. Backend must be one ofhosted,gemini,openai,anthropic. Thedefault-targetfield must be a valid BCP 47 language code.