Skip to main content

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​

ModuleServiceKindRequiredParentVendor-default keyDefault provider / model
PLANNERcoreLLMClientyes—yesopenai / gpt-4.1-mini
CLICKUP_AGENTcoreLLMClient (tool loop + remote MCP)no—noopenai / gpt-4o
CLICKUP_CONTENTcoreLLMClientnoCLICKUP_AGENT (key only)noopenai / gpt-4.1-mini
LOGS_AGENTcoreLLMClient (tool loop)no—yesopenai / gpt-4.1-mini
IMPLEMENTATIONcore + workersCodingAgent (implement)core: no · workers: yes—yesopenai / gpt-6-sol
DOCS_GENERATIONcoreCodingAgent (implement)noIMPLEMENTATIONvia parentinherits parent
BUG_HUNTERworkersCodingAgent (analyze)yes—noopenai / gpt-6-sol
PR_CLASSIFIERworkersCodingAgent (analyze)yes—noopenai / gpt-6-sol
SECURITY_DEPSworkersCodingAgent (implement)yes—noanthropic / claude-sonnet-5-5
SECURITY_SCANworkersCodingAgent (implement)yes—noanthropic / claude-opus-5-5
DIGESTworkersLLMClientyes—noopenai / gpt-4.1-mini
DIGEST_MONTHLYworkersLLMClientyesDIGESTnoinherits parent
INCIDENT_SUPPORTworkersLLMClient (tool loop)yes (incident-support worker only)—noopenai / gpt-6-sol

SDKs per kind:

  • LLMClient: OpenAI Chat Completions / Responses API on openai, Anthropic Messages API on anthropic. The ClickUp agents use remote MCP on both.
  • CodingAgent: Codex SDK on openai, Claude Agent SDK on anthropic.

Prod task definitions set LOGS_AGENT_LLM_MODEL=gpt-5.4; the code default is gpt-4.1-mini.

Per-module vars​

VarValues
<MODULE>_LLM_PROVIDERopenai | anthropic
<MODULE>_LLM_MODELModel id. Required when the provider differs from the module's code default.
<MODULE>_LLM_API_KEYSecret.
<MODULE>_LLM_MAX_TOKENSPositive integer, default 16000. LLMClient modules only.
<MODULE>_LLM_EFFORTlow | 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:

  1. provider: M_LLM_PROVIDER, else P's provider (full-inheritance children only), else M's default.
  2. 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 naming M_LLM_MODEL.
  3. 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.
  4. unconfigured: a required module fails startup naming M_LLM_API_KEY. An optional module is disabled and logged, unless M_LLM_PROVIDER is set explicitly, in which case startup fails.
  5. maxTokens / effort: M, then P (full inheritance only), then the default.

Notes:

  • CLICKUP_CONTENT inherits only the key from CLICKUP_AGENT, and only when providers match. Without CLICKUP_AGENT_LLM_API_KEY both ClickUp modules are disabled, even if OPENAI_API_KEY is set.
  • SECURITY_DEPS and SECURITY_SCAN use 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 from IMPLEMENTATION. 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_MONTHLY and DOCS_GENERATION take 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 logs for LOGS_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 }, where keySource is module, parent:<MODULE> or vendor-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-* on openai, gpt-* / o<digit>* on anthropic).

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 007 seeds claude-opus-5-5, claude-sonnet-5-5 and claude-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 and envVar name 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: LLMRefusalError takes the module's normal failure path (same user-facing message), is not retried, and is logged with outcome: "refusal".
  • Provider errors: 429 / 5xx / network errors get the SDK's 2 retries, then surface as LLMProviderError through the module's failure path.
  • Unparseable JSON: LLMOutputParseError, logged with outcome: "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