build_config_list() returns the [{model, base_url, api_key, api_type}] shape AutoGen expects, using the same env/keyfile resolution the CLI already performs.
config_list first.
Quick Start
How It Works
Return Shape
| Key | Source |
|---|---|
model | LLMEndpoint.model — resolved from MODEL_NAME, OPENAI_MODEL_NAME, or provider default |
base_url | LLMEndpoint.base_url — resolved from OPENAI_BASE_URL, OPENAI_API_BASE, or provider default |
api_key | LLMEndpoint.api_key — resolved from provider-specific env var or stored credentials |
api_type | Always "openai" (AutoGen convention) — omitted when include_api_type=False |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
include_api_type | bool | True | Set False to match callers that historically omit AutoGen’s api_type field |
The legacy import
from praisonai.llm.config import build_config_list still works — it resolves to the same function object via a sys.modules shim. You do not need to migrate existing code. The unit test test_c5_backward_compat.py::test_module_identity asserts praisonai.llm.config is praisonai_code.llm.config.Best Practices
Set the provider env var before calling
Set the provider env var before calling
Resolution is done at call time — set
OPENAI_API_KEY (or the provider-appropriate env var like ANTHROPIC_API_KEY) before calling build_config_list().Cache the result in hot loops
Cache the result in hot loops
If you build many AutoGen agents in a hot loop, cache the result — the endpoint resolver reads disk (
~/.praison/config) on every call:Prefer resolve_llm_endpoint() for non-AutoGen consumers
Prefer resolve_llm_endpoint() for non-AutoGen consumers
For non-AutoGen consumers, prefer
resolve_llm_endpoint() directly and avoid the api_type field — it returns a typed LLMEndpoint dataclass with model, base_url, and api_key fields:Related
LLM Endpoint Config
Endpoint precedence rules and provider routing
Model Catalogue
Choose the model that goes into the config_list
Standalone LLM Modules
All four LLM modules available in praisonai-code
PraisonAI Code CLI
The standalone runtime these modules power

