LiteLLM Setup
LiteLLM is a Python SDK and proxy that calls many LLM APIs in the OpenAI format. This guide connects it to the API in about 3 minutes.
1. Create an API key
- Sign up on the registration page.
- In the console, open the API token page, create a token, and copy the key. It starts with
sk-.
2. Connect LiteLLM
Python SDK. Use the openai/ prefix with the Gateway base URL:
import litellm
response = litellm.completion(
model="openai/claude-sonnet-5-5",
api_base="https://api.cmoso.com/v1",
api_key="sk-...",
messages=[{"role": "user", "content": "Say hello"}],
)
print(response.choices[0].message.content)
LiteLLM Proxy. Add the models to config.yaml:
model_list:
- model_name: claude-sonnet-5-5
litellm_params:
model: openai/claude-sonnet-5-5
api_base: https://api.cmoso.com/v1
api_key: os.environ/GATEWAY_API_KEY
Then start the proxy with litellm --config config.yaml.
3. Pick a model and test
Send a request to the proxy at http://localhost:4000/v1/chat/completions with "model": "claude-sonnet-5-5".
Popular model IDs: claude-sonnet-5-5, gpt-5.4, gemini-3.1-flash-lite, deepseek-v4-pro, qwen3.5-plus.
Troubleshooting
- 401 Unauthorized: the API key is wrong or disabled. Copy it again from the console.
- Model not found: check the model ID spelling. IDs are case-sensitive.
- Connection error: check that the base URL ends with
/v1and has no trailing slash.