LLM providers
Every LLM call goes through @alakai/llm (packages/llm). Each module picks its own provider (openai or anthropic), model and key from env. There is no global LLM_PROVIDER / LLM_MODEL and no fallback to legacy var names. With nothing set, every module resolves to its code default (OpenAI for all of them except SECURITY_DEPS and SECURITY_SCAN, which default to Anthropic).
Source of truth: LLM_MODULES in packages/llm/src/config.ts.
Modules
| Module | Service | Kind | Required | Parent | Vendor-default key | Default provider / model |
|---|---|---|---|---|---|---|
PLANNER | core | LLMClient | yes | — | yes | openai / gpt-4.1-mini |
CLICKUP_AGENT | core | LLMClient (tool loop + remote MCP) | no | — | no | openai / gpt-4o |
CLICKUP_CONTENT | core | LLMClient | no | CLICKUP_AGENT (key only) | no | openai / gpt-4.1-mini |
LOGS_AGENT | core | LLMClient (tool loop) | no | — | yes | openai / gpt-4.1-mini |
IMPLEMENTATION | core + workers | CodingAgent (implement) | core: no · workers: yes | — | yes | openai / gpt-6-sol |
DOCS_GENERATION | core | CodingAgent (implement) | no | IMPLEMENTATION | via parent | inherits parent |
BUG_HUNTER | workers | CodingAgent (analyze) | yes | — | no | openai / gpt-6-sol |
PR_CLASSIFIER | workers | CodingAgent (analyze) | yes | — | no | openai / gpt-6-sol |
SECURITY_DEPS | workers | CodingAgent (implement) | yes | — | no | anthropic / claude-sonnet-5-5 |
SECURITY_SCAN | workers | CodingAgent (implement) | yes | — | no | anthropic / claude-opus-5-5 |
DIGEST | workers | LLMClient | yes | — | no | openai / gpt-4.1-mini |
DIGEST_MONTHLY | workers | LLMClient | yes | DIGEST | no | inherits parent |
INCIDENT_SUPPORT | workers | LLMClient (tool loop) | yes (incident-support worker only) | — | no | openai / gpt-6-sol |
SDKs per kind:
- LLMClient: OpenAI Chat Completions / Responses API on
openai, Anthropic Messages API onanthropic. The ClickUp agents use remote MCP on both. - CodingAgent: Codex SDK on
openai, Claude Agent SDK onanthropic.
Prod task definitions set LOGS_AGENT_LLM_MODEL=gpt-5.4; the code default is gpt-4.1-mini.
Per-module vars
| Var | Values |
|---|---|
<MODULE>_LLM_PROVIDER | openai | anthropic |
<MODULE>_LLM_MODEL | Model id. Required when the provider differs from the module's code default. |
<MODULE>_LLM_API_KEY | Secret. |
<MODULE>_LLM_MAX_TOKENS | Positive integer, default 16000. LLMClient modules only. |
<MODULE>_LLM_EFFORT | low | medium | high | xhigh | max. openai accepts only low/medium/high, and only on reasoning models. Leave it unset for gpt-4o / gpt-4.1*. |
Vendor default keys: OPENAI_API_KEY, ANTHROPIC_API_KEY. Only PLANNER, LOGS_AGENT and IMPLEMENTATION read them (and DOCS_GENERATION through its parent).
Resolution rules
For module M with optional parent P:
- provider:
M_LLM_PROVIDER, else P's provider (full-inheritance children only), else M's default. - model:
M_LLM_MODEL, else P's model if M inherits fully and providers match, else M's default model if the provider is M's default provider, else startup fails namingM_LLM_MODEL. - key:
M_LLM_API_KEY, else P's key if providers match, else the vendor default key (only for modules marked above), else the module is unconfigured. - unconfigured: a required module fails startup naming
M_LLM_API_KEY. An optional module is disabled and logged, unlessM_LLM_PROVIDERis set explicitly, in which case startup fails. - maxTokens / effort: M, then P (full inheritance only), then the default.
Notes:
CLICKUP_CONTENTinherits only the key fromCLICKUP_AGENT, and only when providers match. WithoutCLICKUP_AGENT_LLM_API_KEYboth ClickUp modules are disabled, even ifOPENAI_API_KEYis set.SECURITY_DEPSandSECURITY_SCANuse only their own key (SECURITY_DEPS_LLM_API_KEY,SECURITY_SCAN_LLM_API_KEY), with no parent and no vendor-default fallback, so their spend shows up apart fromIMPLEMENTATION. Both keys are secrets in the shared worker task definition: they must exist in the Secrets Manager secret before a task definition that references them is deployed, or no worker task starts.DIGEST_MONTHLYandDOCS_GENERATIONtake provider, model and key from their parent. If you switch the child to a different provider, set its model and key explicitly.- Non-LLM gating still applies: ClickUp OAuth config for the ClickUp modules, and at least one repo with
logsforLOGS_AGENT.
Startup logs
Each service resolves every module it hosts at startup and logs one line per module. Keys are never logged.
llm.config.resolved { module, provider, model, keySource }, wherekeySourceismodule,parent:<MODULE>orvendor-default.llm.module.disabled { module, reason }for an optional module with no key.llm.config.model_mismatch(warn) when a model id looks like the other vendor's (claude-*onopenai,gpt-*/o<digit>*onanthropic).
Switching one module to Claude
Set all three vars for that module. Other modules are unaffected.
PR_CLASSIFIER_LLM_PROVIDER=anthropic
PR_CLASSIFIER_LLM_MODEL=claude-sonnet-5-5
PR_CLASSIFIER_LLM_API_KEY=sk-ant-...
- The model must be explicit: there is no Anthropic default model.
- The model needs an analytics row, or its usage is recorded at $0. Analytics migration
007seedsclaude-opus-5-5,claude-sonnet-5-5andclaude-haiku-5-5. Any other Claude model needs its own migration first. See Analytics. - In prod, add the secret under the new name before deploying.
- Check the startup log for
llm.config.resolved { module: "PR_CLASSIFIER", provider: "anthropic", ... }.
Errors
LLMConfigError: thrown at startup. Its message andenvVarname the variable to fix: unknown provider, missing model for a non-default provider, missing key on a required or explicitly configured module, invalid max tokens, or an effort the provider doesn't support.- Refusals:
LLMRefusalErrortakes the module's normal failure path (same user-facing message), is not retried, and is logged withoutcome: "refusal". - Provider errors: 429 / 5xx / network errors get the SDK's 2 retries, then surface as
LLMProviderErrorthrough the module's failure path. - Unparseable JSON:
LLMOutputParseError, logged withoutcome: "parse_error". Existing module retries still apply.
Vendor SDK import guard
Only packages/llm may import openai, @openai/codex-sdk, @anthropic-ai/sdk or @anthropic-ai/claude-agent-sdk. Check from the repo root:
yarn lint:llm-imports