Call Confidential Inference from LiteLLM
Route LiteLLM to Confidential Inference with the openai/ provider prefix and api_base https://api.confidential.ai/v1, from the Python SDK or the LiteLLM proxy config.
LiteLLM reaches Confidential Inference through its generic OpenAI-compatible provider: prefix the model ID with openai/ and set api_base.
Prerequisites
- A Confidential AI API key. Keys are issued by email: request access or write to hello@confidential.ai.
CONFIDENTIAL_API_KEYset in your environment.- Python 3.10+.
Checked on 2 November 2026 with litellm 1.106.6.
Call it from Python
import os
from litellm import completion
resp = completion(
model="openai/deepseek-ai/DeepSeek-V4.1-Flash-1017",
api_base="https://api.confidential.ai/v1",
api_key=os.environ["CONFIDENTIAL_API_KEY"],
messages=[{"role": "user", "content": "Explain remote attestation in one sentence."}],
)
print(resp.choices[0].message.content)Everything after openai/ is the exact model ID from GET /v1/models.
Or add it to the proxy
In the LiteLLM proxy config.yaml:
model_list:
- model_name: confidential-deepseek-v4.1-flash
litellm_params:
model: openai/deepseek-ai/DeepSeek-V4.1-Flash-1017
api_base: https://api.confidential.ai/v1
api_key: os.environ/CONFIDENTIAL_API_KEYClients of the proxy then request confidential-deepseek-v4.1-flash.
Verify before sending sensitive input
The client does not check attestation. Follow the attestation guide to configure and start TEErminator with the reviewed production pins. Before sending sensitive input, change api_base in the Python call or proxy configuration to http://127.0.0.1:8080/v1. Keep the same API key. TEErminator verifies the upstream connection before forwarding requests.
How you know it worked
The call returns a chat completion. For a 401, read the error code: invalid_api_key indicates an authentication failure; model_not_authorized means a listed model ID is required.
The LiteLLM proxy reads prompts in plaintext before forwarding them over TLS. Run it on infrastructure you trust, or inside a confidential VM, so the proxy doesn't widen your trust boundary.