SPH LiteLLM Portal

Get Key

Enter the access code you received for your workshop session to get a LiteLLM API key.

How to use the key

The API is OpenAI-compatible. See full documentation for setup guides, spending check, etc. There are two kinds of models:

Cloud (openrouter/*): commercial models served through OpenRouter, for example:

# 1. Install the library (in your terminal):
#      pip install openai
#
# 2. Save this file as llm_demo.py (replace <your key> with your key)
#
# 3. Run it (in your terminal):
#      python3 llm_demo.py

from openai import OpenAI

client = OpenAI(api_key="<your key>", base_url="https://litellm.sph-prod.ethz.ch/v1")
response = client.chat.completions.create(
    model="openrouter/openai/gpt-6-luna",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

On-prem:

These run locally on our server. Requests are not retained and stay within the ETH network — they never go to the public internet.

# 1. Install the library (in your terminal):
#      pip install openai
#
# 2. Save this file as llm_demo.py (replace <your key> with your key)
#
# 3. Run it (in your terminal):
#      python3 llm_demo.py

from openai import OpenAI

client = OpenAI(api_key="<your key>", base_url="https://litellm.sph-prod.ethz.ch/v1")
response = client.chat.completions.create(
    model="sph-onprem/qwen3.8-27b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)