Docs /Getting Started/LiteLLM

LiteLLM

LiteLLM gives you a unified interface to access multiple LLMs, track LLM usage, setup guardrails, custom logging and more.

Installation

First, make sure you have the litellm library installed, if not you can install it by running:

pip install litellm

Basic Completion Example

This example shows you how to make a simple completion request to a Featherless AI model.

Set the FEATHERLESS_API_KEY environment variable to your Featherless API key before running either example. In the model value, featherless_ai/ is LiteLLM's provider-routing prefix; deepseek-ai/DeepSeek-V4.1-Flash-1017 is the exact model ID from the Featherless catalogue. Keep both parts when calling LiteLLM.

Completion Example
import os
from litellm import completion
response = completion(
    model="featherless_ai/deepseek-ai/DeepSeek-V4.1-Flash-1017",
    api_key=os.environ["FEATHERLESS_API_KEY"],
    messages=[{"role": "user", "content": "Write a short poem about AI."}]
)
print(response.choices[0].message.content)

Streaming Example

LiteLLM also supports streaming responses

Streaming Example
import os
from litellm import completion

response_stream = completion(
    model="featherless_ai/deepseek-ai/DeepSeek-V4.1-Flash-1017",
    api_key=os.environ["FEATHERLESS_API_KEY"],
    messages=[{"role": "user", "content": "Tell me a fun fact about space"}],
    stream=True
)

print("Streaming response:")
for chunk in response_stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
print("\n\nStreaming complete.")

Resources

Last edited: Nov 12, 2026