Skip to main content
Available for: Python and TypeScript.
LiteLLM provides a unified interface for 100+ LLM providers. In Python, patch the litellm module directly with patch_litellm(). In TypeScript, wrapLiteLLM() points a wrapped OpenAI-compatible client at your LiteLLM proxy server — the Node ecosystem doesn’t have a litellm client package, so TypeScript apps talk to LiteLLM through its OpenAI-compatible proxy endpoint instead of an in-process SDK.

Installation

TypeScript only needs the openai package — wrapLiteLLM() builds an OpenAI client internally and points it at your running LiteLLM proxy server. Python calls the litellm package’s module-level completion() / acompletion() functions directly, no proxy required.

Setup

wrapLiteLLM() takes a { baseURL, apiKey } options object (not a client instance) and returns an OpenAI-compatible wrapped client pointed at that proxy. patch_litellm() monkey-patches litellm.completion and litellm.acompletion at the module level — no client object to construct at all.

Example

Both litellm.completion(..., stream=True) (Python, sync and async) and streaming calls through the wrapped TypeScript client are traced end-to-end, including time-to-first-token.

What gets captured