afraid-scarlet
afraid-scarlet3mo ago

How to integrate models via litellm.

I have gpt-4o and openrouter llama-3.3 models available on my litellm. I want to use them to run actions. How to do it. Getting the following error:
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - Error code: 400 - {'error': {'message': {'error': '/chat/completions: Invalid model name passed in model=gpt-4o. Call `/v1/models` to view available models for your key.'}, 'type': 'None', 'param': 'None', 'code': '400'}}
Received Model Group=openai/gpt-4o
Available Model Group Fallbacks=None LiteLLM Retried: 1 times, LiteLLM Max Retries: 2
litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - Error code: 400 - {'error': {'message': {'error': '/chat/completions: Invalid model name passed in model=gpt-4o. Call `/v1/models` to view available models for your key.'}, 'type': 'None', 'param': 'None', 'code': '400'}}
Received Model Group=openai/gpt-4o
Available Model Group Fallbacks=None LiteLLM Retried: 1 times, LiteLLM Max Retries: 2
code is as follows:
router = Router(
model_list=[
{
"model_name": "openai/gpt-4o",
"litellm_params": {
"model": "openai/gpt-4o",
"api_key": "",
"base_url": ""
},
}
]
)

response = router.completion(
model="openai/gpt-4o",
messages=[
{"role": "user", "content": "Post the following tweet : This is a test tweet"},
],
tools=actions,
tool_choice="auto",
)
router = Router(
model_list=[
{
"model_name": "openai/gpt-4o",
"litellm_params": {
"model": "openai/gpt-4o",
"api_key": "",
"base_url": ""
},
}
]
)

response = router.completion(
model="openai/gpt-4o",
messages=[
{"role": "user", "content": "Post the following tweet : This is a test tweet"},
],
tools=actions,
tool_choice="auto",
)
3 Replies
wise-white
wise-white3mo ago
Composio Docs
Using Composio With LiteLLM - Composio
Composio enables your agents to connect with Various Tools and work with them
afraid-scarlet
afraid-scarletOP3mo ago
I am following this doc only, but not able to run it via openai/gpt-4o getting invalid model name passed @Karthikeya
genetic-orange
genetic-orange2mo ago
Try it once again @frenzyScholar

Did you find this page helpful?