Skip to content

add LiteLLM and NVIDIA NIM support, enable custom models#767

Open
JustSadY wants to merge 7 commits into
TauricResearch:mainfrom
JustSadY:main
Open

add LiteLLM and NVIDIA NIM support, enable custom models#767
JustSadY wants to merge 7 commits into
TauricResearch:mainfrom
JustSadY:main

Conversation

@JustSadY
Copy link
Copy Markdown

@JustSadY JustSadY commented May 7, 2026

  • Integrated litellm and nvidia as OpenAI-compatible providers.
  • Added default base URLs and .env variables (NVIDIA_API_KEY, LITELLM_API_KEY).
  • Updated CLI to include LiteLLM and NVIDIA NIM in the provider selection menu.
  • Enabled "Custom model ID" input option for all LLM providers (OpenAI, Anthropic, Google, xAI, Ollama, etc.).

- Integrated `litellm` and `nvidia` as OpenAI-compatible providers.
- Added default base URLs and `.env` variables (NVIDIA_API_KEY, LITELLM_API_KEY).
- Updated CLI to include LiteLLM and NVIDIA NIM in the provider selection menu.
- Enabled "Custom model ID" input option for all LLM providers (OpenAI, Anthropic, Google, xAI, Ollama, etc.).
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for NVIDIA NIM and LiteLLM providers by updating the environment variable templates, CLI selection utilities, and the model catalog. It also introduces a "Custom model ID" option for several existing providers to allow for arbitrary model selection. Feedback indicates that the model validation logic should be updated to accommodate the new "custom" option to avoid unnecessary warnings. Additionally, it is recommended to handle missing API keys for the new providers more explicitly to prevent confusing fallbacks to the OpenAI API key.

("GPT-5.4 Nano - Cheapest, high-volume tasks", "gpt-5.4-nano"),
("GPT-5.4 - Latest frontier, 1M context", "gpt-5.4"),
("GPT-4.1 - Smartest non-reasoning model", "gpt-4.1"),
("Custom model ID", "custom"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding the "custom" option to the model catalog is a useful feature for allowing arbitrary model IDs. However, please note that the validate_model function in tradingagents/llm_clients/validators.py (which is not part of this diff) currently checks if the model ID is in the known list for the provider.

Since the user replaces the selection with a custom string in the CLI, any custom model ID entered will trigger a RuntimeWarning stating that the model is unknown. To fix this, you should update validators.py to include nvidia and litellm in the exclusion list (similar to ollama and openrouter), or update the logic to return True if the provider's catalog contains the "custom" option.

Comment on lines +120 to +121
"nvidia": ("https://integrate.api.nvidia.com/v1", "NVIDIA_API_KEY"),
"litellm": ("http://localhost:4000/v1", "LITELLM_API_KEY"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For the new nvidia and litellm providers, if the corresponding environment variables (NVIDIA_API_KEY or LITELLM_API_KEY) are not set in the .env file, the OpenAIClient will implicitly fall back to using OPENAI_API_KEY due to the default behavior of the underlying ChatOpenAI class.

This can lead to confusing authentication errors when connecting to non-OpenAI endpoints. Consider if these providers should have a default dummy key (like "nvidia" or "litellm") when the environment variable is absent, similar to how ollama is handled in the get_llm method logic (line 160).

JustSadY added 6 commits May 8, 2026 12:19
Expanded TradingAgents framework with advanced Hedge Fund capabilities:
- Multi-Ticker & Super Portfolio Manager: Supports multiple tickers simultaneously and outputs dynamic portfolio allocations.
- New Analysts Added: Macro, Options, Quantitative, and Earnings Analysts integrated into the LangGraph pipeline.
- Live Web Search Module: Integrated modular local SearxNG for scraping real-time earnings/SEC data.
- Historical Backtesting Engine: Added MACD & RSI backtesting tools to enforce data-driven Trader decisions.
- Configurable Prompts: Linked the Portfolio Manager's system prompt (e.g., $100k capital simulation) to default_config.py for easy user customization.
Improved CLI user experience by persisting state and adding smart defaults:
- Ticker Persistence: CLI now remembers the last analyzed ticker(s) and uses it as the default input.
- Smart Date Default: Analysis date prompt now automatically defaults to today's date if left empty.
- Custom Model Memory: Pre-fills the "Enter model ID" prompt with the previously used custom model ID for faster iteration.
- Questionary Fixes: Resolved a ValueError crash by passing the exact Choice object for default UI selections.
Introduced a new Performance Review Analyst for automated hindsight accountability:
- Review Analyst Agent: Added a dedicated agent to evaluate the system's past trading decisions against actual market outcomes.
- Past Performance Tool: Created `get_past_performance_data` tool to parse local logs (~/.tradingagents/logs/) and calculate real ROI using yfinance.
- Graph Integration: Wired the Review Analyst into the LangGraph workflow (`conditional_logic`, `setup.py`, `trading_graph.py`).
- State & UI Updates: Added `review_report` to AgentState and exposed the new analyst in the interactive CLI checklist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant