mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix Openrouter (#4641)
This commit is contained in:
parent
2587220b12
commit
bde978cf0f
@ -91,9 +91,13 @@ class LLM(RetryMixin, DebugMixin):
|
||||
# litellm actually uses base Exception here for unknown model
|
||||
self.model_info: ModelInfo | None = None
|
||||
|
||||
if self.config.model.startswith('openrouter'):
|
||||
self.model_info = litellm.get_model_info(self.config.model)
|
||||
elif self.config.model.startswith('litellm_proxy/'):
|
||||
try:
|
||||
if self.config.model.startswith('openrouter'):
|
||||
self.model_info = litellm.get_model_info(self.config.model)
|
||||
except Exception as e:
|
||||
logger.debug(f'Error getting model info: {e}')
|
||||
|
||||
if self.config.model.startswith('litellm_proxy/'):
|
||||
# IF we are using LiteLLM proxy, get model info from LiteLLM proxy
|
||||
# GET {base_url}/v1/model/info with litellm_model_id as path param
|
||||
response = requests.get(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user