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 AdditionalLLMs

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

Overview

Concrete LLM integrations for Aliyun, Novita, SiliconFlow providers and cost tracking utilities.

Description

Additional LLM provider integrations extending `OpenAILLM`:

  • AliyunLLM — Aliyun Bailian (DashScope/Qwen) integration. Uses OpenAI-compatible endpoint with workspace-specific `base_url`. Recovers cost via litellm's dashscope/ pricing prefix. Supports native tool calling. Registered as "AliyunLLM" with alias "aliyun_llm".
  • NovitaLLM — Novita AI integration. Uses OpenAI-compatible API at `api.novita.ai/openai`. Token usage tracked but dollar cost unavailable. Registered as "NovitaLLM" with alias "novita".
  • SiliconFlowLLM — SiliconFlow integration. Uses OpenAI-compatible API at `api.siliconflow.com`. Hosts open-source models (Qwen, Deepseek, etc.). Registered as "SiliconFlowLLM" with alias "siliconflow".
  • Cost & CostManager (`model_utils.py`) — `Cost` tracks input/output tokens and costs. `CostManager` (thread-safe singleton) accumulates costs across calls and exports to pandas DataFrame. `get_openai_model_cost()` reads litellm's model pricing. `infer_litellm_company_from_model()` maps model names to providers.

Usage

  • Aliyun/Qwen: Use `AliyunLLMConfig` with `AliyunLLM` for Alibaba's Qwen models.
  • Novita: Use `NovitaConfig` with `NovitaLLM` for low-cost open-source models.
  • SiliconFlow: Use `SiliconflowConfig` with `SiliconFlowLLM` for SiliconFlow-hosted models.
  • Cost tracking: Use `CostManager` to monitor API spending across workflow executions.

Code Reference

Source Location

Signature

class AliyunLLM(OpenAILLM):
    # Registered as "AliyunLLM", alias "aliyun_llm"
    # OpenAI-compatible endpoint with workspace base_url
    ...

class NovitaLLM(OpenAILLM):
    # Registered as "NovitaLLM", alias "novita"
    # api.novita.ai/openai
    ...

class SiliconFlowLLM(OpenAILLM):
    # Registered as "SiliconFlowLLM", alias "siliconflow"
    # api.siliconflow.com
    ...

class Cost:
    input_tokens: int
    output_tokens: int
    cost: float

class CostManager:
    # Thread-safe singleton
    def add_cost(self, cost: Cost) -> None
    def to_dataframe(self) -> pd.DataFrame

Import

from evoagentx.models.aliyun_model import AliyunLLM
from evoagentx.models.novita_model import NovitaLLM
from evoagentx.models.siliconflow_model import SiliconFlowLLM
from evoagentx.models.model_utils import Cost, CostManager

I/O Contract

Inputs

Name Type Required Description
config LLMConfig Yes Provider-specific LLM config

Outputs

Name Type Description
LLM instance BaseLLM LLM with generate/async_generate methods
CostManager CostManager Singleton tracking API costs

Usage Examples

Aliyun Qwen Model

from evoagentx.models.model_configs import AliyunLLMConfig
from evoagentx.models.aliyun_model import AliyunLLM

config = AliyunLLMConfig(model="qwen-plus", ...)
llm = AliyunLLM(config)
response = llm.generate("Hello, world!")

Track Costs

from evoagentx.models.model_utils import CostManager

manager = CostManager()
# ... execute workflow ...
df = manager.to_dataframe()
print(df)

Related Pages

Implements Principle

Requires Environment

Page Connections

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