LiteLLM
Use Cortecs with the LiteLLM Python SDK and proxy
LiteLLM provides a Python SDK and an OpenAI-compatible proxy for calling multiple LLM providers. Its native Cortecs integration lets you use Cortecs models through the same interface as your other providers.
1. Install LiteLLM
For the Python SDK:
pip install --upgrade litellmSet your API key and a Cortecs model ID in your environment:
export CORTECS_API_KEY="your-cortecs-api-key"
export CORTECS_MODEL="gpt-6.1-sol"Use the cortecs/ prefix when passing a model to LiteLLM. For example, the Cortecs model ID gpt-6.1-sol becomes cortecs/gpt-6.1-sol. LiteLLM reads CORTECS_API_KEY automatically and uses https://api.cortecs.ai/v1 as the default API base URL.
2. Connect to Cortecs
Responses API
Use Responses for new agent workflows:
import os
import litellm
response = litellm.responses(
model=f"cortecs/{os.environ['CORTECS_MODEL']}",
input="Explain model routing in two sentences.",
extra_headers={"x-cortecs-cost-unit": "USD"},
)
print(response.output[0].content[0].text)Chat Completions
For workflows that expect Chat Completions:
Pass Cortecs routing options such as preference, allowed_providers or eu_native through extra_body. See Routing Concept for the available options.
Embeddings
Choose an embedding model from the Cortecs catalogue:
3. Use the LiteLLM proxy
The proxy lets existing applications call Cortecs through a shared LiteLLM endpoint.
Install the proxy dependencies:
Create a config.yaml file:
Set a proxy key and start the server from the same shell where you exported CORTECS_API_KEY:
Send a request to the proxy:
Applications use the model_name alias, such as cortecs-chat. The litellm_params.model value selects the Cortecs model. Authenticate applications with the LiteLLM proxy key; the proxy uses your Cortecs API key for upstream requests.
Decisions
With the cortecs-decisions deployment above, call LiteLLM's decision endpoint:
LiteLLM translates this request to the Cortecs /v1/systemone format and returns a normalized decision response. See Decisions for the Cortecs API reference.
Last updated