Models and providers
Pick a model
| Form | Example | Provider | Model |
|---|---|---|---|
| Provider and model id | model.openai("gpt-4o") | named | named |
| Provider and tier | model.mistral.fast | named | from the table below |
| Tier only | model.balanced | the first provider with a key, in the order of the table | from the table |
| String | model("anthropic:claude-sonnet-4-6"), model("openai:fast") | named | named, or from the table |
| Custom endpoint | model.openaiCompatible({ baseURL, model, apiKeyEnv }) | any OpenAI-compatible server | named |
The same forms work for agentNode({ model }) and for one-off calls with .invoke(). A string
also works directly: agentNode({ model: "openai:gpt-4o" }). An unknown provider is an error.
Providers, keys and tiers
| Provider | Key | fast | balanced | frontier | creative |
|---|---|---|---|---|---|
| anthropic | ANTHROPIC_API_KEY | claude-haiku-4-5 | claude-sonnet-4-6 | claude-opus-4-8 | claude-fable-5 |
| openai | OPENAI_API_KEY | gpt-4o-mini | gpt-4o | gpt-4o | gpt-4o |
GEMINI_API_KEY or GOOGLE_API_KEY | gemini-2.5-flash | gemini-2.5-flash | gemini-2.5-pro | gemini-2.5-flash | |
| mistral | MISTRAL_API_KEY | mistral-small-latest | mistral-medium-latest | mistral-large-latest | mistral-large-latest |
| openrouter | OPENROUTER_API_KEY | openai/gpt-4o-mini | openai/gpt-4o-mini | openai/gpt-4o | openai/gpt-4o |
| minimax | MINIMAX_API_KEY | MiniMax-Text-01 | MiniMax-Text-01 | MiniMax-Text-01 | MiniMax-Text-01 |
| huggingface | HF_TOKEN or HUGGINGFACE_API_KEY | meta-llama/Llama-3.3-70B-Instruct | meta-llama/Llama-3.3-70B-Instruct | meta-llama/Llama-3.3-70B-Instruct | meta-llama/Llama-3.3-70B-Instruct |
| ollama | AILU_USE_OLLAMA=1 | mistral | mistral | mistral | mistral |
| lmstudio | AILU_USE_LMSTUDIO=1 | local-model | local-model | local-model | local-model |
A missing key fails the call with the name of the variable to set. AILU_LLM_MOCK=1 turns
missing keys into calls to the deterministic offline mock instead.
Local servers need no key but must be switched on: AILU_USE_OLLAMA=1 (with
AILU_OLLAMA_BASE_URL for a server not on http://localhost:11434/v1), AILU_USE_LMSTUDIO=1
(with AILU_LMSTUDIO_BASE_URL).
Custom endpoints
model.openaiCompatible points an agent at any server that speaks the OpenAI chat-completions
API: vLLM, LM Studio, LiteLLM, Azure OpenAI, a company gateway.
model.openaiCompatible({
baseURL: "https://gateway.example.com/v1",
model: "llama-3.1-70b",
apiKeyEnv: "GATEWAY_API_KEY" // sent as a Bearer token; omit for a keyless server
});
The key is read only from apiKeyEnv. Your OPENAI_API_KEY is never sent to a custom endpoint.
Anthropic and Gemini have their own APIs and can't be pointed at a custom URL.
Authorize custom destinations
Custom endpoints are denied by default. Set AILU_MODEL_ENDPOINT_ALLOWLIST in the embedding
host's environment to a comma-separated list of exact base URLs before running a graph or
calling .invoke():
AILU_MODEL_ENDPOINT_ALLOWLIST="https://models.example.com/v1,http://127.0.0.1:1234/v1"
The engine compares parsed URLs, including scheme, port and base path. Host case, default
ports and trailing slashes are normalized. Prefixes and wildcards do not grant access.
Credentials in URLs, queries, fragments and malformed entries are refused. An unset, empty or
invalid list denies custom endpoints with AILU_MODEL_ENDPOINT_NOT_ALLOWED. This check also
applies when constructing a graph for replay.
Only the trusted operator should configure this list. Listing an endpoint authorizes its
destination, including its DNS and network routing; it is not a public-IP filter. HTTP and
private/local servers work when explicitly listed, so list only services intended to receive
model requests. Redirects are never followed. Built-in providers and the host-controlled
AILU_OLLAMA_BASE_URL / AILU_LMSTUDIO_BASE_URL routes keep their existing configuration.
Restrict endpoint credentials separately with the variable allowlist below.
Restrict the variables apiKeyEnv may name
A graph names the variable its key is read from. Before using a named key, the operator must
set AILU_API_KEY_ENV_ALLOWLIST to the variables meant to hold endpoint keys: exact names and
prefixes ending in *, separated by commas. Only list keys intended for endpoints that graph
authors may choose; this list authorizes variable names, not endpoint origins.
AILU_API_KEY_ENV_ALLOWLIST="AILU_ENDPOINT_*,GATEWAY_KEY"
An apiKeyEnv that matches no entry is refused before anything is read, whether the variable
exists or not. The error names the variable, never a value: ApiKeyEnvNotAllowedError (code
AILU_API_KEY_ENV_NOT_ALLOWED) from .invoke() and from a graph run whose agent names it, and
ailu.ApiKeyEnvNotAllowedError from Python's llm_complete. Elsewhere (a Python graph run, the
C ABI) the engine's message starts with AILU_API_KEY_ENV_NOT_ALLOWED:. Unset or empty, the list
allows no named variable. To migrate a keyed custom endpoint, explicitly list its key variable.
Endpoints without an apiKeyEnv remain keyless. Names are trimmed, and the list applies
only to apiKeyEnv, not to a provider's own variable such as OPENAI_API_KEY.
This is a breaking default change for keyed custom endpoints and for TypeScript standalone
provider-key overrides such as model.openai("gpt-4o", { apiKeyEnv: "CORP_OPENAI_KEY" }).invoke(...),
even without baseURL. Python's llm_complete uses api_key_env only when base_url is supplied;
it does not use that selector to override a built-in provider's variable without base_url.
Follow the named-credential migration guide before upgrading.
A bare * entry explicitly allows every variable name, removing this restriction. Use exact
names or narrow prefixes for keys that graph authors may access.