Chats
dev-api

Encrypted Chat Completions (RVENC)

Changed on

Create a chat completion from an end-to-end encrypted payload, decrypted only inside the confidential compute environment. Stateless: no chat history is kept and no files can be attached.

post/rvenc/chat/completions

Request

  • Base URL
    https://gateway.prem.io
  • Auth
    HTTP bearer and API key in header Authorization

Headers

X-Queue-Timeoutstring
Example:0

Maximum seconds the request may wait in the inference queue when no capacity is free (decimals allowed). 0 never queues: a saturated model answers 429 immediately. Values above the server budget (10s) are capped; the header can only shorten the wait, never extend it. Invalid values are ignored. A request that cannot be admitted in time gets 429 with Retry-After.

Request body

encryptedInferencestring required

Encrypted JSON string containing all chat completion parameters. When decrypted, this string must match the structure shown in the expandable _decryptedInference property below (reference only - do not send this property).

cipherTextstring required

Cipher text for shared secret generation (ECDH key exchange)

noncestring required

Nonce used for encrypting the inference payload

modelstring required

Model identifier to use for completion

streamboolean

If true, returns a server-sent events stream. If false, returns JSON with encryptedResponse and nonce. May also be set inside encryptedInference.

Example request

{
  "encryptedInference": "encrypted_inference_payload_data",
  "cipherText": "cipher_text_for_key_exchange",
  "nonce": "nonce_value",
  "model": "deepseek-v4.1-flash"
}

Response

RVENC chat completion response. Returns JSON when stream is false or omitted (default), or a server-sent events stream when stream is true.

encryptedResponsestring required

Encrypted JSON string containing the chat completion result. Decrypt using XChaCha20-Poly1305 with the shared secret (derived from cipherText) and the response nonce.

noncestring required

Hex-encoded nonce used for decrypting the encryptedResponse payload.

Example response

{
  "encryptedResponse": "a1b2c3d4e5f67890abcdef1234567890abcdef123456789012345678901234567890abcdef",
  "nonce": "f6e5d4c3b2a19876543210fedcba9876",
  "usage": {
    "model": "qwen36-27b",
    "prompt_tokens": 10,
    "completion_tokens": 5,
    "reasoning_tokens": 0,
    "total_tokens": 15
  }
}

Changes

    • breaking

      the request property became required

    • warning

      added the new 405.00 enum value to the / response property for the response status

    • warning

      added the new 405.00 enum value to the / response property for the response status

    • warning

      added the new 405.00 enum value to the response property for the response status

    • warning

      added the new 409.00 enum value to the / response property for the response status

    • warning

      added the new 409.00 enum value to the / response property for the response status

    • warning

      added the new 409.00 enum value to the response property for the response status

    • warning

      added the new 500.00 enum value to the / response property for the response status

    • warning

      added the new 500.00 enum value to the / response property for the response status

    • warning

      added the new 500.00 enum value to the response property for the response status

    • info

      added the new optional header request parameter X-Queue-Timeout

    • info

      added the new max enum value to the request property /

    • info

      added the new xhigh enum value to the request property /

    • info

      added the non-success response with the status

    • info

      endpoint added