Skip to content

Configuration

yaku stores configuration in a YAML file. Find its location with:

~/.config/yaku/config.yaml
yaku config path

The file is created automatically when you first run yaku config set. You can also edit it directly — yaku preserves comments and formatting.

FieldTypeDefaultDescription
api-keystringLLM API key for local backends (Gemini, OpenAI, Anthropic).
default-targetstringDefault target language. Lets you omit --to.
backendstringhostedLLM backend: hosted, gemini, openai, anthropic. Validated on set.
modelstringbackend defaultModel name override (e.g., gemini-2.5-flash, gpt-4o-mini).
api-basestringAPI base URL override for any local backend. Commonly used with OpenAI-compatible providers.
hosted-urlstringhttps://api.yakulang.comHosted service API endpoint. Auth endpoints are derived automatically (strips api. prefix).
promptstringPath to a custom system prompt file. Applied to every translation.
~/.config/yaku/config.yaml
api-key: AIzaSy...your-gemini-key
default-target: en
backend: gemini
model: gemini-2.5-flash
Terminal window
# Set a value
yaku config set default-target zh-TW
# Read a value (from file only, ignores environment variables)
yaku config get default-target
# Find the config file
yaku config path

Environment variables override config file values. This is useful for CI/CD, containers, or switching between projects.

VariableOverrides config fieldExample
YAKU_API_KEYapi-keyexport YAKU_API_KEY=AIza...
YAKU_DEFAULT_TARGETdefault-targetexport YAKU_DEFAULT_TARGET=zh-TW
YAKU_BACKENDbackendexport YAKU_BACKEND=openai
YAKU_MODELmodelexport YAKU_MODEL=gpt-4o
YAKU_API_BASEapi-baseexport YAKU_API_BASE=https://api.groq.com/openai/v1
YAKU_HOSTED_URLhosted-urlexport YAKU_HOSTED_URL=https://api.staging.yakulang.com

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:

Terminal window
# Explicitly empty → overrides config file, key becomes empty
YAKU_API_KEY="" yaku --backend gemini --to en "test"
# Error: YAKU_API_KEY is set but empty (check your key source).

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):

BackendFallback variable
geminiGOOGLE_API_KEY
openaiOPENAI_API_KEY
anthropicANTHROPIC_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:

Terminal window
export GOOGLE_API_KEY=your-gemini-key
export OPENAI_API_KEY=your-openai-key
yaku --backend gemini --to en "Bonjour"
yaku --backend openai --to en "Bonjour"

When the same setting is specified in multiple places, the highest-priority source wins:

  1. Command-line flag (highest) — e.g., --to ja
  2. Environment variable — e.g., YAKU_DEFAULT_TARGET=ja
  3. Config file~/.config/yaku/config.yaml
  4. Built-in default (lowest)

Example: If your config file has default-target: en but you run yaku --to ja, the target language is ja.

  • 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 set rejects keys that are not in the list above.
  • Invalid config value: yaku config set validates values. Backend must be one of hosted, gemini, openai, anthropic. The default-target field must be a valid BCP 47 language code.