Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ANative Lab EvoAgentX LLMConfigs

From Leeroopedia
Knowledge Sources
Domains Models, Configuration
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete pydantic config classes for all LLM providers, serving as the configuration layer for every agent and workflow.

Description

The LLMConfig base class defines `llm_type` and `model`. Provider-specific configs include: OpenAILLMConfig (temperature, max_tokens, tools, reasoning_effort, response_format), AzureOpenAIConfig, LiteLLMConfig (multi-provider keys), SiliconflowConfig, OpenRouterConfig (enable_prompt_caching), AliyunLLMConfig, and NovitaConfig. Each config inherits `BaseConfig` and is registered via `MODEL_REGISTRY`. Every agent and workflow references an `LLMConfig` subclass.

Usage

  • OpenAI: `OpenAILLMConfig(model="gpt-4o-mini", openai_key="sk-...")` for OpenAI API.
  • OpenRouter: `OpenRouterConfig(model="anthropic/claude-3.5-sonnet", openrouter_key="...")` for multi-provider routing.
  • LiteLLM: `LiteLLMConfig(model="openai/gpt-4o", ...)` for unified multi-provider access.
  • Aliyun: `AliyunLLMConfig(...)` for Aliyun Qwen models.
  • Novita: `NovitaConfig(...)` for Novita AI models.
  • SiliconFlow: `SiliconflowConfig(...)` for SiliconFlow models.

Code Reference

Source Location

Signature

class LLMConfig(BaseConfig):
    llm_type: str
    model: str

class OpenAILLMConfig(LLMConfig):
    llm_type: str = "OpenAILLM"
    model: str
    openai_key: Optional[str] = None
    temperature: Optional[float] = None
    max_completion_tokens: Optional[int] = None
    stream: Optional[bool] = None
    # ... additional OpenAI params

class OpenRouterConfig(LLMConfig):
    llm_type: str = "OpenRouterLLM"
    model: str
    openrouter_key: Optional[str] = None
    openrouter_base: str = "https://openrouter.ai/api/v1"
    enable_prompt_caching: Optional[bool] = None

class LiteLLMConfig(LLMConfig):
    llm_type: str = "LiteLLM"
    model: str
    openai_key: Optional[str] = None
    anthropic_key: Optional[str] = None
    api_base: Optional[str] = None
    is_local: Optional[bool] = False

class AliyunLLMConfig(LLMConfig): ...
class NovitaConfig(LLMConfig): ...
class SiliconflowConfig(LLMConfig): ...
class AzureOpenAIConfig(LLMConfig): ...

Import

from evoagentx.models.model_configs import (
    LLMConfig, OpenAILLMConfig, AzureOpenAIConfig, LiteLLMConfig,
    SiliconflowConfig, OpenRouterConfig, AliyunLLMConfig, NovitaConfig,
)

I/O Contract

Inputs

Name Type Required Description
model str Yes Model name/identifier
openai_key str No OpenAI API key (or env var)
temperature float No Sampling temperature
max_completion_tokens int No Max output tokens

Outputs

Name Type Description
config instance LLMConfig Consumed by LLM class constructor (e.g. `OpenAILLM(config)`)

Usage Examples

OpenAI Configuration

from evoagentx.models.model_configs import OpenAILLMConfig

config = OpenAILLMConfig(
    model="gpt-4o-mini",
    openai_key="sk-...",
    temperature=0.7,
    max_completion_tokens=1000,
)

OpenRouter Configuration

from evoagentx.models.model_configs import OpenRouterConfig

config = OpenRouterConfig(
    model="anthropic/claude-3.5-sonnet",
    openrouter_key="sk-or-...",
    enable_prompt_caching=True,
)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment