LiteLLMOpenAI Cookbook
Content
LiteLLMOpenAI Cookbook
Note: Fork and clone this repository if needed
1. Create and activate a virtual environment
python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate
2. Export your LITELLM_API_KEY
Whichever model you use- openai, huggingface, xai, the api key will be by the name of LITELLM_API_KEY
export LITELLM_API_KEY=***
3. Install libraries
uv pip install -U openai 'litellm[proxy]' ddgs duckdb yfinance agno
4. Start the proxy server
litellm --model gpt-5.6-luna --host 127.0.0.1 --port 4000
or, if you want to use some other model like from Anthropic
litellm --model claude-3-sonnet-20240229 --host 127.0.0.1 --port 4000
5. Run basic Agent
python cookbook/90_models/litellm_openai/basic.py
6. Run Agent with Tools
- DuckDuckGo Search
python cookbook/90_models/litellm_openai/tool_use.pySource and license
- Source
- Agno
- Original
- agno-agi/agno/cookbook/90_models/litellm_openai
- License
- Apache-2.0