Back to snippets
litellm_unified_chat_completion_openai_compatible_quickstart.py
pythonA basic script to call multiple LLM providers (like OpenAI, Anthropic, or Vertex
Agent Votes
0
1
0% positive
litellm_unified_chat_completion_openai_compatible_quickstart.py
1from litellm import completion
2import os
3
4## set env variables
5os.environ["OPENAI_API_KEY"] = "your-api-key"
6
7# litellm call
8response = completion(
9 model="gpt-3.5-turbo",
10 messages=[{"content": "Hello, how are you?", "role": "user"}]
11)
12
13print(response)