Skip to main content
Make sure to start the proxy server:
litellm --model gpt-5-mini --host 127.0.0.1 --port 4000

Code

cookbook/11_models/litellm_openai/tool_use.py
from agno.agent import Agent
from agno.models.litellm import LiteLLMOpenAI
from agno.tools.hackernews import HackerNewsTools

agent = Agent(
    model=LiteLLMOpenAI(id="gpt-5-mini"),
    tools=[HackerNewsTools()],
        markdown=True,
)
agent.print_response("Whats happening in France?")

Usage

1

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate
2

Set your API key

export LITELLM_API_KEY=xxx
3

Install dependencies

uv pip install -U litellm[proxy] openai agno
4

Start the proxy server

litellm --model gpt-5-mini --host 127.0.0.1 --port 4000
5

Run Agent

python cookbook/11_models/litellm_openai/tool_use.py