Environment variables
The engine reads these at the moment it needs them, so a change applies to the next run.
Model providers
| Variable | Used for |
|---|---|
ANTHROPIC_API_KEY | model.anthropic(...) |
OPENAI_API_KEY | model.openai(...), and createEmbeddings({ provider: "openai" }) |
GEMINI_API_KEY or GOOGLE_API_KEY | model.gemini(...) |
MISTRAL_API_KEY | model.mistral(...), and createEmbeddings() (Mistral is the default provider) |
OPENROUTER_API_KEY | model.openrouter(...) |
MINIMAX_API_KEY | model.minimax(...) |
HF_TOKEN or HUGGINGFACE_API_KEY | model.huggingface(...) |
AILU_USE_OLLAMA=1, AILU_OLLAMA_BASE_URL | Turn on model.ollama(...); the server URL (default http://localhost:11434/v1). |
AILU_USE_LMSTUDIO=1, AILU_LMSTUDIO_BASE_URL | Turn on model.lmstudio(...); the server URL (default http://localhost:1234/v1). |
The variable you name in apiKeyEnv | The key for a custom endpoint, or a TypeScript standalone provider-key override. Requires an explicit allowlist match. |
AILU_API_KEY_ENV_ALLOWLIST | Host-authorized variable names for apiKeyEnv: comma-separated exact names and trailing-star prefixes (AILU_ENDPOINT_*,GATEWAY_KEY). Unset or empty denies named reads. A bare * permits every name. Includes TypeScript standalone provider overrides without baseURL; Python uses its selector only with base_url. This is a breaking default change; see migration and matching rules. |
AILU_MODEL_ENDPOINT_ALLOWLIST | Host-authorized custom model base URLs, separated by commas. Exact parsed URL matches only; unset, empty or invalid denies all custom endpoints. Explicitly listed local/private HTTP servers are supported. See Models and providers. |
AILU_LLM_MOCK=1 | Offline mode: calls without a key answer from the deterministic mock instead of failing. For tests and CI. |
AILU_HTTP_READ_TIMEOUT_SECS | How long to wait for a model response. Default 600. |
Governance
| Variable | Used for |
|---|---|
AILU_SECRETS_POLICY=block | Fail a model call that contains a secret, instead of masking the secret. |
AILU_SECRETS_REDACTOR_URL, AILU_SECRETS_REDACTOR_TOKEN | An extra secrets-detection service, after the built-in one. |
AILU_PII_REDACTOR_URL, AILU_PII_REDACTOR_TOKEN | A personal-data redaction service. The engine posts { texts, runId } (runId only when the call names its run) and expects { texts, blocked? }. |
AILU_PII_REDACTOR_FAIL_CLOSED=1 | Don't send the text when the redaction service is unreachable. |
AILU_LLM_RECORD=1 | Record model calls and timestamps, for replay. |
Agents and retrieval
| Variable | Used for |
|---|---|
AILU_FS_BACKEND_URL, AILU_FS_BACKEND_TOKEN | A storage service for the agents' virtual filesystem, instead of memory. |
AILU_RERANK_ENDPOINT | A cross-encoder service for components.reranker. |
AILU_LLMLINGUA_URL | Where the prompt-compression service of the compress middleware is. Setting it compresses nothing by itself: only an agent whose middleware names compress (or whose profile includes it) is compressed. |
AILU_LLMLINGUA_BODY | The shape of the request body: text (default) sends { "text", "rate" }; inputs sends { "inputs", "parameters": { "rate" } }, for a Hugging Face Inference Endpoint, which refuses a body without inputs and writes the refused body to its logs. The answer is { "compressed" } in both. Any other value turns compression off. |
AILU_LLMLINGUA_TOKEN | A bearer token sent to that service (Authorization: Bearer …). Never logged. |
AILU_LLMLINGUA_TIMEOUT_MS | How long one compression call may take, in milliseconds. Default 2000. Past it, the original text is sent to the model. Independent of AILU_HTTP_READ_TIMEOUT_SECS. |
AILU_LLMLINGUA_RATE, AILU_LLMLINGUA_MIN_CHARS | The share of tokens to keep (default 0.5) and the shortest message it compresses (default 240 characters). |
TAVILY_API_KEY | components.webSearch. |
Observability
| Variable | Used for |
|---|---|
AILU_OTEL_EXPORTER_URL | The default endpoint of exportTracesToOtlp. |