Use /model with LiteLLM
Call /model from LiteLLM's Python SDK or its proxy, with the openai/ prefix for any model and anthropic/ for Claude.
Checked November 23, 2026
LiteLLM reaches /model with its openai/ prefix for any model, or anthropic/ for Claude, in its Python SDK and its proxy.
Before you start
- A /model API key: create one on the API keys page and add credit on the credits page.
Python SDK
bash
pip install litellmPython
import os
import litellm
key = os.environ["SLASHMODEL_API_KEY"]
messages = [{"role": "user", "content": "Say hello in French."}]
gpt = litellm.completion(
model="openai/gpt-6.1-sol",
api_base="https://api.slashmodel.com/v1",
api_key=key,
messages=messages,
)
print(gpt.choices[0].message.content)
claude = litellm.completion(
model="anthropic/claude-sonnet-5-5",
api_base="https://api.slashmodel.com", # no /v1: LiteLLM adds /v1/messages
api_key=key,
messages=messages,
max_tokens=1024,
)
print(claude.choices[0].message.content)Proxy
List the models in the proxy's config.yaml, then start it:
config.yaml
model_list:
- model_name: gpt-6.1-sol
litellm_params:
model: openai/gpt-6.1-sol
api_base: https://api.slashmodel.com/v1
api_key: os.environ/SLASHMODEL_API_KEY
- model_name: claude-sonnet-5-5
litellm_params:
model: anthropic/claude-sonnet-5-5
api_base: https://api.slashmodel.com
api_key: os.environ/SLASHMODEL_API_KEYbash
litellm --config config.yamlGood to know
openai/needs the base URL with/v1.anthropic/needs it without, because LiteLLM adds/v1/messagesitself.- On
anthropic/calls, LiteLLM setsmax_tokensto the most the model can write when you leave it out. Set your own, as above, to cap an answer's length. - The model ids are /model's, from the pricing page, after the prefix:
openai/gpt-6.1-sol,anthropic/claude-sonnet-5-5.