You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Openrouter configuration might overwrite previous API settings without checking if Azure AD was already configured. Consider adding a condition to prevent unintended overrides.
Avoid redundant check for None in the second call to get_settings().get(). The first check already confirms the key exists, and the second call uses the same default value unnecessarily.
# Support for Openrouter models
if get_settings().get("OPENROUTER.KEY", None):
- openrouter_api_key = get_settings().get("OPENROUTER.KEY", None)+ openrouter_api_key = get_settings().get("OPENROUTER.KEY")
os.environ["OPENROUTER_API_KEY"] = openrouter_api_key
litellm.api_key = openrouter_api_key
openai.api_key = openrouter_api_key
Apply / Chat
Suggestion importance[1-10]: 3
__
Why: The suggestion correctly identifies a redundant None default in the get_settings().get("OPENROUTER.KEY", None) call on line 123. Since the if condition on line 122 already ensures the key exists and its value is not None, providing None as a default in the subsequent get() call is unnecessary. The change is a minor code cleanup.
Low
More
Author self-review: I have reviewed the PR code suggestions, and addressed the relevant ones.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement, Documentation
Description
Added Openrouter API support to
litellm_ai_handlerUpdated documentation for Openrouter model usage
Extended secrets template to include Openrouter settings
Changes walkthrough 📝
litellm_ai_handler.py
Add Openrouter API key and base support to handlerpr_agent/algo/ai_handlers/litellm_ai_handler.py
changing_a_model.md
Document Openrouter model configuration and usagedocs/docs/usage-guide/changing_a_model.md
.secrets_template.toml
Add Openrouter section to secrets templatepr_agent/settings/.secrets_template.toml