Skip to content

Connect LiteLLM to Apertis

Add Apertis as the upstream of the LiteLLM Proxy you already run, so OpenAI and Anthropic SDK clients keep their local endpoint while requests route through one Apertis key.

Before you configure the upstream

No card is required to create an account. Choose a Coding Plan or add PAYG balance before your first API request.

  1. Create an Apertis account.
  2. Choose current access on the Coding Plans page or add PAYG balance in Credits.
  3. Create a scoped upstream key in API Keys. Keep it out of source control and logs.

Configure the Apertis upstream

Add Apertis to the model_list in the LiteLLM Proxy config.yaml with LiteLLM’s built-in apertis/ provider. Set api_base to the Apertis base URL explicitly, because the provider’s built-in default is a legacy address, and read the key from the APERTIS_API_KEY environment variable rather than writing it into the file. With an explicit api_key, the provider’s own STIMA_API_KEY variable is not needed. Keep allowed_openai_params: without it, LiteLLM can refuse a request that carries tools for a model ID it has no function-calling record for.

Compare this example with the current official provider guide for Apertis in LiteLLM and the installed version.

# config.yaml
# export APERTIS_API_KEY=YOUR_APERTIS_API_KEY
model_list:
  - model_name: YOUR_MODEL_ID
    litellm_params:
      model: apertis/YOUR_MODEL_ID
      api_base: https://api.apertis.ai/v1
      api_key: os.environ/APERTIS_API_KEY
      allowed_openai_params: ["tools", "tool_choice", "parallel_tool_calls"]

Replace YOUR_MODEL_ID with an exact current ID from the live model catalog. Clients call the model_name alias, so you can rename it without changing the upstream ID. Add more model entries only after verifying each one.

Install the proxy with its extras, then start it with this configuration. Recent LiteLLM releases need Python 3.10 or later.

uv tool install 'litellm[proxy]'
litellm --config config.yaml

Use either SDK in both response modes

Pick a response mode and an SDK, then copy the example. Each example calls the local proxy on its default port, 4000, with the proxy’s own key: its LITELLM_MASTER_KEY, or any value when none is set. Never send your Apertis key to the proxy.

Response
Python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_LOCAL_PROXY_KEY",
    base_url="http://localhost:4000/v1",
)

response = client.chat.completions.create(
    model="YOUR_MODEL_ID",
    messages=[{"role": "user", "content": "Reply with OK"}],
    stream=False,
)
print(response.choices[0].message.content)

Verify the routed request

Run one non-streaming request first, then its streaming equivalent. A completed setup is a model response followed by a matching request record in Activity. Repeat the check with the second SDK before moving a larger workload.