cheapaimodel

LiteLLM

Call cheapaimodel models from the LiteLLM Python SDK, or serve them through LiteLLM Proxy.

Copy

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 settingValue
Base URLapi_basehttps://api.cheapaimodel.ai/v1
API keyapi_keyYour key from the console's API Keys page
Model IDmodelopenai/deepseek-v4-1-flash: openai/ plus any ID from the catalog

Set it up

Terminal
pip install litellm
app.py
import 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. The openai/ prefix is missing. LiteLLM uses the prefix to pick the provider and fails before sending anything. Write openai/deepseek-v4-1-flash.
  • litellm.NotFoundError or Invalid URL (POST /v1/chat/completions/chat/completions). api_base is missing /v1, or it includes the endpoint path. Set it to exactly https://api.cheapaimodel.ai/v1.
  • Embeddings pointed at cheapaimodel. cheapaimodel has no embedding models yet, so litellm.embedding() or an embedding entry in model_list has 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() raises This model isn't mapped yet. Your real spend is on the console's Logs page. To track it in the proxy, set input_cost_per_token and output_cost_per_token under the entry's model_info: the per-million-token prices on the model page, divided by 1,000,000.
Copy
Open in

On this page