LiteLLM
Call cheapaimodel models from the LiteLLM Python SDK, or serve them through LiteLLM Proxy.
LiteLLM reaches OpenAI-compatible services through its openai/ model prefix. Use it directly from Python, or list cheapaimodel models in a LiteLLM Proxy config.
| LiteLLM setting | Value | |
|---|---|---|
| Base URL | api_base | https://api.cheapaimodel.ai/v1 |
| API key | api_key | Your key from the console's API Keys page |
| Model ID | model | openai/deepseek-v4-1-flash: openai/ plus any ID from the catalog |
Set it up
pip install litellmimport os
import litellm
response = litellm.completion(
model="openai/deepseek-v4-1-flash",
api_base="https://api.cheapaimodel.ai/v1",
api_key=os.environ["CHEAPAIMODEL_API_KEY"],
messages=[{"role": "user", "content": "Explain recursion in one sentence."}],
)
print(response.choices[0].message.content)
# Streaming
stream = litellm.completion(
model="openai/deepseek-v4-1-flash",
api_base="https://api.cheapaimodel.ai/v1",
api_key=os.environ["CHEAPAIMODEL_API_KEY"],
messages=[{"role": "user", "content": "Write a haiku about rivers."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)LiteLLM drops the openai/ prefix before sending, so the request reaches /v1/chat/completions with "model": "deepseek-v4-1-flash".
Common mistakes
LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=deepseek-v4-1-flash. Theopenai/prefix is missing. LiteLLM uses the prefix to pick the provider and fails before sending anything. Writeopenai/deepseek-v4-1-flash.litellm.NotFoundErrororInvalid URL (POST /v1/chat/completions/chat/completions).api_baseis missing/v1, or it includes the endpoint path. Set it to exactlyhttps://api.cheapaimodel.ai/v1.- Embeddings pointed at cheapaimodel. cheapaimodel has no embedding models yet, so
litellm.embedding()or an embedding entry inmodel_listhas nothing to call here. Keep embeddings on another provider. - LiteLLM shows no cost for these calls. Its built-in price list doesn't include cheapaimodel models: the proxy records a cost of 0, and
litellm.completion_cost()raisesThis model isn't mapped yet. Your real spend is on the console's Logs page. To track it in the proxy, setinput_cost_per_tokenandoutput_cost_per_tokenunder the entry'smodel_info: the per-million-token prices on the model page, divided by 1,000,000.