Skip to content
Tech News
← Back to articles

Litelm: LiteLLM Without the Bloat

read original get O'Reilly "Fluent Python" by Luciano Ramalho → more articles
Why This Matters

litelm is a stripped-down fork of litellm that keeps only the multi-provider call path — routing, message translation, streaming, tool use, embeddings — in ~2,900 lines with two dependencies. It's a drop-in API-compatible replacement, so switching is a find-and-replace on imports. It reflects a broader pushback against dependency bloat in the fast-growing LLM tooling layer, where teams want a thin abstraction rather than a platform.

Key Takeaways
Worth a Look

O'Reilly "Fluent Python" by Luciano Ramalho — If lean, readable Python libraries like litelm appeal to you, this book is a deep dive into writing idiomatic, minimal-dependency Python. It covers data models, generators, async, and the kind of design thinking that turns 100k lines into 2,900.

See O'Reilly "Fluent Python" by Luciano Ramalho on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

litelm

litellm's routing + translation in ~2,900 lines and 2 dependencies ( openai , httpx ).

litellm routes LLM calls across providers and translates between message formats. That core is buried under 100k+ LOC of proxy servers, caching layers, cost tracking, and dozens of features most users never touch. litelm extracts just the call path — model routing, message translation, streaming, tool use, embeddings — and nothing else. No Router class, no proxy, no caching.

Install

pip install litelm # openai + httpx pip install litelm[anthropic] # + anthropic SDK pip install litelm[bedrock] # + boto3 pip install litelm[all] # everything

Usage

import litelm # Basic completion response = litelm . completion ( "openai/gpt-4o" , messages = [{ "role" : "user" , "content" : "Hello!" }]) print ( response . choices [ 0 ]. message . content ) # Streaming for chunk in litelm . completion ( "groq/llama-3.1-70b-versatile" , messages = [...], stream = True ): print ( chunk . choices [ 0 ]. delta . content or "" , end = "" ) # Embeddings response = litelm . embedding ( "openai/text-embedding-3-small" , input = [ "hello world" ])

Every function has an async variant: acompletion , aembedding , aresponses , atext_completion .

The API mirrors litellm — same function names, same arguments, same response types. If you're using litellm today, switching is s/litellm/litelm/ in your imports.

What's in / what's out

... continue reading