LiteLLM: Call 100+ LLM APIs With One Unified OpenAI Interface
LiteLLM normalizes the APIs of OpenAI, Anthropic, Bedrock, Gemini, and 100+ other providers into one OpenAI-compatible interface with built-in fallbacks and cost tracking.
If you write code against the OpenAI SDK and later want to switch to Claude or Gemini, you rewrite your API calls. If you want fallback logic (try GPT-4o, fall back to Claude if it's down), you implement it yourself. If you want to track spend across providers, you build that too.
LiteLLM solves all three problems with a single library and an optional proxy server.
The completion() Function
from litellm import completion
# OpenAI
response = completion(model="gpt-4o", messages=[{"role": "user", "content": "Hello"}])
# Anthropic - same function, same response format
response = completion(model="claude-3-5-sonnet-20241022", messages=[{"role": "user", "content": "Hello"}])
# Bedrock Claude
response = completion(model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0", messages=[{"role": "user", "content": "Hello"}])
# Gemini
response = completion(model="gemini/gemini-1.5-pro", messages=[{"role": "user", "content": "Hello"}])
Every response comes back in OpenAI format regardless of provider.
Team workspace
Ship faster with chat, meetings, and projects in one place — Zlyqor.
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
538
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.
What Is Alibaba Banning Claude Code Over Backdoor Risks? A Practical Overview
Alibaba is reportedly banning Claude Code from its workplace due to alleged backdoor risks. This post explains the incident, the technical concerns, and the broader implications for AI coding assistants in regulated environments.