11---
2- title : LLM config (llm_config.json)
2+ title : LLM config profiles
33---
44
5- # LLM config (llm_config.json)
5+ # LLM config profiles
66
7- This file defines which LLM providers and models PlanExe can use. Each top‑level key is a model id used in the UI and pipeline.
7+ PlanExe supports ** 4 model profiles ** :
88
9- ` llm_config.json ` lives in the PlanExe repo root and is read at runtime. Environment variables are substituted from ` .env ` .
9+ - ` baseline `
10+ - ` premium `
11+ - ` frontier `
12+ - ` custom `
13+
14+ Each profile maps to a separate config file:
15+
16+ - ` baseline ` → ` llm_config.json `
17+ - ` premium ` → ` llm_config.premium.json `
18+ - ` frontier ` → ` llm_config.frontier.json `
19+ - ` custom ` → ` llm_config.custom.json ` (or ` PLANEXE_LLM_CONFIG_CUSTOM_FILENAME ` )
20+
21+ If the selected profile file is missing or invalid, PlanExe safely falls back to ` llm_config.json ` .
22+
23+ ---
24+
25+ ## How profile selection works
26+
27+ ### Runtime env var
28+
29+ Set:
30+
31+ - ` PLANEXE_MODEL_PROFILE=baseline|premium|frontier|custom `
32+
33+ This is passed end-to-end in worker execution paths (frontend/API/task parameters → worker pipeline).
34+
35+ ### Request/task parameter
36+
37+ Task producers (web frontend, MCP) can include:
38+
39+ - ` model_profile `
40+
41+ Invalid values are normalized to ` baseline ` .
42+
43+ ---
44+
45+ ## Strict filename validation
46+
47+ Config filenames are strictly validated:
48+
49+ - must be a ** filename only** (no ` / ` , ` \\ ` , absolute path)
50+ - must match: ` llm_config*.json `
51+
52+ This prevents path traversal and unsafe file selection.
53+
54+ Legacy override ` PLANEXE_LLM_CONFIG_NAME ` is still supported for backward compatibility, but profile-based selection is preferred.
55+
56+ ---
57+
58+ ## Provider-priority ordering per profile
59+
60+ Within each profile config file, priority is defined per model entry:
61+
62+ - lower ` priority ` value = tried first
63+ - higher ` priority ` value = fallback order
64+
65+ ` auto ` mode uses this profile-specific priority ordering.
1066
1167---
1268
13- ## File structure
69+ ## File format (same for all profile files)
1470
1571``` json
1672{
@@ -24,8 +80,6 @@ This file defines which LLM providers and models PlanExe can use. Each top‑lev
2480 "api_key" : " ${OPENROUTER_API_KEY}" ,
2581 "temperature" : 0.1 ,
2682 "timeout" : 60.0 ,
27- "is_function_calling_model" : false ,
28- "is_chat_model" : true ,
2983 "max_tokens" : 8192 ,
3084 "max_retries" : 5
3185 }
@@ -35,41 +89,11 @@ This file defines which LLM providers and models PlanExe can use. Each top‑lev
3589
3690---
3791
38- ## Top-level fields
92+ ## Backward compatibility
3993
40- - ** comment** : Plain‑text description for humans. Optional.
41- - ** priority** : Lower number = higher priority when ` auto ` is selected. Optional.
42- - ** luigi_workers** : Number of Luigi workers used for this model. Use ` 1 ` for local models (Ollama/LM Studio).
43- - ** class** : Provider class name (e.g., ` OpenRouter ` , ` OpenAI ` , ` Ollama ` , ` LMStudio ` , ` OpenAILike ` ).
44- - ** arguments** : Provider‑specific settings passed to the LLM client.
45-
46- ---
47-
48- ## Common arguments
49-
50- These keys are common across most providers:
51-
52- - ** model** / ** model_name** : Provider model identifier.
53- - ** api_key** : API key reference (usually ` ${ENV_VAR} ` ).
54- - ** base_url** / ** api_base** : Override the provider base URL.
55- - ** temperature** : Controls randomness. Lower is more deterministic.
56- - ** timeout** / ** request_timeout** : Max time per request in seconds.
57- - ** max_tokens** / ** max_completion_tokens** : Output token limit (provider specific).
58- - ** max_retries** : Retry count on transient errors.
59- - ** is_function_calling_model** : Whether the model supports structured/tool output.
60- - ** is_chat_model** : Whether the model uses chat format.
61-
62- ---
63-
64- ## Choosing values
65-
66- - Use ** luigi_workers = 1** for local models (Ollama / LM Studio).
67- - Use ** luigi_workers > 1** for cloud models if you want parallel tasks.
68- - Keep ** timeout** higher for slower models.
69-
70- ---
94+ When no profile is provided, PlanExe defaults to:
7195
72- ## Notes
96+ - ` baseline `
97+ - ` llm_config.json `
7398
74- - If ` llm_config.json ` is missing, PlanExe logs a warning and proceeds with defaults.
75- - Changes to ` llm_config.json ` require a container restart (or rebuild if baked into the image).
99+ So existing deployments continue to work without changes.
0 commit comments