API Spec
OpenAI-compatible confidential inference, API-key authentication, and C8s attestation.
The production endpoint is https://api.confidential.ai.
The gateway checks API keys before it sends a request to the inference service. It does not send the API key to the inference service.
Quickstart
export CONFIDENTIAL_API_BASE='https://api.confidential.ai'
export CONFIDENTIAL_API_KEY='<API_KEY>'
curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/models" | jq .curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/chat/completions" \
-H "Authorization: Bearer $CONFIDENTIAL_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
"messages": [{"role": "user", "content": "Reply with one word."}],
"stream": false
}' | jq .Authentication
POST /v1/chat/completions and POST /v1/completions require this header:
Authorization: Bearer <API_KEY>/health, /ready, /v1/models, /allowlist, and /v1/discovery are public.
No API key is needed for these routes. The model catalog is common to all
callers; it is not filtered by API key.
Keep your API key private. Contact Confidential AI if you need a new key or need to disable an existing key.
Health
GET /health
Returns the health of the gateway process.
curl --fail --silent "$CONFIDENTIAL_API_BASE/health" | jq .Example response:
{"status":"ok"}Health is not attestation evidence.
GET /ready
Returns 200 once the gateway holds a key snapshot from the admin. Before
that, it returns 503. This check does not call the inference workers or
establish that they can serve requests.
curl --fail --silent "$CONFIDENTIAL_API_BASE/ready" | jq .Example response:
{"status":"ready"}Attestation
Production v0.16.2 uses native C8s verification. Follow the attestation guide to verify the signed release, configure deployment pins, and send requests through TEErminator.
The HTTPS examples on this page do not perform C8s attestation. For generic C8s policy-history and transport checks, see Verify a deployment.
GET /allowlist
Returns the active C8s workload policy. Its SHA-256 must match the exact policy that the client reviewed and approved.
curl --fail --silent "$CONFIDENTIAL_API_BASE/allowlist" -o allowlist-live.json
sha256sum allowlist-live.jsonA downloaded policy is not a trust anchor by itself. Verify it through the pinned connection and compare it with the signed release policy, as shown in Protect inference.
GET /v1/discovery
Returns C8s connection metadata, public and Trust Authority certificate information, and TDX evidence. This document does not contain an aggregate receipt for every inference worker. Reading it is not a complete attestation check.
curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/discovery" | jq .The legacy /attestation?nonce=... endpoint is not part of this deployment's
verification flow. Use the current TEErminator profile instead.
Models
GET /v1/models
Returns the model catalog. No API key is needed; the catalog is public.
curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/models" | jq .The production service returns these model IDs:
{
"object": "list",
"data": [
{"id": "deepseek-ai/DeepSeek-V4.1-Flash-1017", "object": "model", "owned_by": "confidential.ai"}
]
}V4.1 is the improved replacement for V4. We now route all V4 requests to V4.1 automatically. Your existing model ID continues to work. Both IDs use the V4.1 backend. Completion responses, including streaming responses, retain the model ID requested by the client.
Chat completions
POST /v1/chat/completions
Accepts an OpenAI-compatible chat-completions request. This endpoint requires
an API key. Use an exact model ID from /v1/models.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | Exact model ID from /v1/models. |
messages | array | yes | OpenAI-compatible messages. |
stream | boolean | no | Use true for server-sent events. |
response_format | object | no | {"type": "json_object"}, or {"type": "json_schema", ...} with strict: true. |
tools | array | no | OpenAI-compatible tool definitions. |
tool_choice | string or object | no | "auto", "none", or a named tool, as in the OpenAI API. |
For streaming requests, the response uses text/event-stream and ends with:
data: [DONE]Structured output
Pass response_format with json_object for any valid JSON, or json_schema
with strict: true to constrain the output to a schema:
curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/chat/completions" \
-H "Authorization: Bearer $CONFIDENTIAL_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
"messages": [{"role": "user", "content": "Name one prime number."}],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "prime",
"strict": true,
"schema": {
"type": "object",
"properties": {"value": {"type": "integer"}},
"required": ["value"],
"additionalProperties": false
}
}
}
}' | jq .Tool calling
Tools work the same way as the OpenAI API: pass tools, get tool_calls back
in the assistant message.
curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/chat/completions" \
-H "Authorization: Bearer $CONFIDENTIAL_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
"messages": [{"role": "user", "content": "What is the weather in Austin?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}],
"tool_choice": "auto"
}' | jq '.choices[0].message.tool_calls'Text completions
POST /v1/completions
Accepts an OpenAI-compatible text-completions request. This endpoint requires an API key.
curl --fail --silent "$CONFIDENTIAL_API_BASE/v1/completions" \
-H "Authorization: Bearer $CONFIDENTIAL_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
"prompt": "Reply with one word.",
"stream": false
}' | jq .The example uses a string prompt. Streaming responses use server-sent
events and end with data: [DONE].
Errors
Gateway inference errors use this shape:
{
"error": {
"code": "machine_readable_code",
"message": "Human-readable message"
}
}invalid_api_key identifies an authentication failure. An unsupported model
returns 401 with model_not_authorized; this does not mean the key is wrong.
| HTTP | Meaning | Action |
|---|---|---|
400 | Invalid JSON, missing model, or invalid inference request. | Correct the request. |
401 | Invalid or inactive API key, or a model that is not authorized. | Read the error code. Use a valid key and a listed model. |
413 | Request is too large. | Reduce the request size. |
429 | Rate or concurrency limit. | Honor Retry-After. |
502 | Invalid or unavailable upstream response. | Fail closed. |
503 | Inference is unavailable, the key snapshot is not ready, or capacity is unavailable. | Retry with backoff. Check readiness and service status. |