LiteLLMLiteLLM 1.101 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
21 small wins to finish your pathNext lesson

Installation and setup

LiteLLM installs from PyPI, with an extra for its gateway server. It reads each provider's key from the environment, and Groq and Gemini both hand out free keys.

litellm[proxy] 1.101.0 and its helpers

[proxy] adds the gateway server. tenacity is needed for retries in lesson 10 and prisma for the gateway's key checks in lesson 18; lessons 10 and 18 show what happens without them. openai is used to call the gateway in lesson 17.

pip install "litellm[proxy]==1.101.0" tenacity prisma openai
Example
from importlib.metadata import version

print(version("litellm"))

Provider keys for completion()Optional

The course registers stand-in providers in lessons 5 and 8, so it runs without a key. For a real call, completion() looks at the prefix of the model name and reads that provider's variable.

ProviderKeyVariablemodel=
GroqFree, console.groq.com/keysGROQ_API_KEY"groq/openai/gpt-oss-120b"
GeminiFree, aistudio.google.com/apikeyGEMINI_API_KEY"gemini/gemini-2.5-flash"
OpenRouterFree models end in :free, openrouter.ai/keysOPENROUTER_API_KEY"openrouter/google/gemma-4-31b-it:free"
OpenAIPaid, platform.openai.com/api-keysOPENAI_API_KEY"openai/gpt-4o-mini"
export GROQ_API_KEY=gsk_...
python
from litellm import completion

response = completion(
    model="groq/openai/gpt-oss-120b",
    messages=[{"role": "user", "content": "Say hello"}],
)
print(response.choices[0].message.content)

A gateway config names the variable instead of holding the key, as os.environ/GROQ_API_KEY. The gateway's own admin key, LITELLM_MASTER_KEY, is set the same way.

yaml
model_list:
  - model_name: fast
    litellm_params:
      model: groq/openai/gpt-oss-120b
      api_key: os.environ/GROQ_API_KEY
Try it yourself
  • Run litellm --help and read the gateway's options.

Little by little, you're building something great.