Skip to main content
POST
OpenAI-compatible chat completion

OpenAI-Compatible Endpoint

SecureAI exposes an OpenAI-compatible surface so you can integrate with any OpenAI SDK by changing only the base URL and API key — no code changes. The full SecureAI security stack (API-key auth, model/index allowlists, SMLTP policy enforcement + entitlements, Prompt Shield, PII/DLP, points billing, and the model redundancy engine) runs underneath.

Endpoint

Point your OpenAI client’s base_url at:
Zero-Knowledge onlyThis surface does not support RAG / knowledge bases. Requests are pinned to Zero-Knowledge. If you need knowledge-base retrieval, use the classic Chat Completion endpoint.

Authentication

Using an OpenAI SDK

Python (openai)

JavaScript (openai)

Request Body

Standard OpenAI fields are supported. messages is required (there is no prompt on this surface). max_completion_tokens is accepted as an alias for max_tokens. The following OpenAI parameters are passed through to the provider as-is: tools, tool_choice, parallel_tool_calls, response_format, stop, top_p, frequency_penalty, presence_penalty, seed, logprobs, top_logprobs, user.

SecureAI extension fields

Send these as extra body fields (via extra_body in the OpenAI SDKs):

Response

Standard OpenAI chat.completion shape, plus a secureai extension object.
secureai.smltp_bundle_id (when present) can be exchanged for a signed compliance receipt.

Streaming

Set stream: true. Frames are native OpenAI chat.completion.chunk objects terminated by data: [DONE]. The secureai extension is attached to the first chunk. choices (including tool_calls deltas and finish_reason) pass through untouched.

Errors

Errors from this handler use the OpenAI envelope:
When a whole redundancy chain fails, the error uses code: "all_models_failed" and status 429 (all rate limits) or 502 (otherwise). Security-middleware rejections keep the SecureAI { "success": false, ... } shape; both always carry a message.

Authorizations

Authorization
string
header
required

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

Body

application/json
model
string
required
Example:

"openai/gpt-5-nano"

messages
object[]
required
temperature
number
max_tokens
integer
stream
boolean
models
string[]
fallback_models
string[]
redundancy
object

{ timeout_ms, first_token_timeout_ms, on[] }

smltp_policy
string
prompt_shield
object

{ enabled?, policy? } per-call Prompt Shield override

Response

OpenAI chat.completion object plus a secureai extension