Skip to main content
POST
Create chat completion (OpenAI-compatible)

Zero Data Retention

This is the standard inference route. Prem sends the request to a trusted partner. Prem does not keep your prompts or completions, and the partner does not keep them. Your content is plaintext at the Prem API Gateway and at the partner. Use /rvenc/chat/completions for a confidential path with client-side encryption and attestation. See ZDR vs Confidential.

Base URL

Set the base URL of an OpenAI client to https://gateway.prem.io/openai. Do not add a /v1 segment.

Streaming

Set "stream": true to get a stream of server-sent events in the OpenAI format:

Model availability

Send a model that GET /openai/models returns for your API key. A confidential-only model returns a 400 status with this message: Model {model} is available for encrypted inference only. See Models & Pricing for the mode errors.

Authorizations

Authorization
string
header
required

Send your access token as header Authorization: Bearer {accessToken}

Authorization
string
header
required

Your API key that starts with sk_live or sk_test. You can create yours at go.prem.io/api-keys.

Body

application/json

Chat completion request in the OpenAI Chat Completions format.

model
string
required

Model name, as listed by GET /models.

messages
object[]
required

Conversation messages.

stream
boolean
default:false

If true, the response is a server-sent events stream.

provider
string

Optional. Pin the request to one of the model's configured backends. Omit to let the platform choose.

Maximum string length: 64
Pattern: ^[a-z0-9][a-z0-9-]*$

Response

A chat completion, or a server-sent events stream when stream is true.

The response is of type object.