{
"status": 429,
"error": "You already have an active chat stream. Please wait for it to complete or try again in a few moments."
}
Endpoints
Encrypted Chat Completions (RVENC)
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.
Reasoning tokens are billed and count against your token rate limits.
See Usage for billing, output-token interaction, and instructions to disable or limit reasoning.The valid reasoning_effort values depend on the model family. See Models & Pricing for the values that each family accepts.
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).
Server-sent events (SSE) stream with encrypted chat completion chunks. The stream contains four types of events:
event: data followed by data: <encrypted_hex_string> - Encrypted chunk that must be decrypted using the same shared secret and nonce from the request. When decrypted, each chunk matches the structure shown in the _decryptedChunk property below (reference only).
event: heartbeat followed by data: {"message":"processing","timestamp":<ms>} - Keep-alive event sent every 5 seconds while waiting for the first inference token. Not encrypted; clients should ignore it.
event: error followed by data: <error_data> - Error event (can be encrypted or plain JSON). Emitted when inference fails or when no inference data is received within 10 minutes.
event: done followed by data: [DONE] - Stream completion marker
Each encrypted data: line contains a hex-encoded string. Decrypt each chunk using XChaCha20-Poly1305 with the shared secret and nonce from your request.
Reference only - This shows the structure that each encrypted chunk should contain when decrypted. Decrypt each chunk in the stream using the same shared secret and nonce from your request to get this structure.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Confidential AI API: Secure LLM Inference at Scale | Prem","colors":{"primary":"#5473BE","light":"#6B87C7","dark":"#4055BF"},"logo":{"light":"https://mintcdn.com/pcci-docs/mrB5JRRZ363u53KU/images/logo/light.svg?fit=max\u0026auto=format\u0026n=mrB5JRRZ363u53KU\u0026q=85\u0026s=7b017ddec6cf9e8ffa387c65ac5dbb79","dark":"https://mintcdn.com/pcci-docs/mrB5JRRZ363u53KU/images/logo/dark.svg?fit=max\u0026auto=format\u0026n=mrB5JRRZ363u53KU\u0026q=85\u0026s=79f520aab4ec2521f89de2daa36ce0d4"},"favicon":{"light":"https://mintcdn.com/pcci-docs/sZ7VgIlZ81owdj52/images/favicon.light.svg?fit=max\u0026auto=format\u0026n=sZ7VgIlZ81owdj52\u0026q=85\u0026s=0b446e7caeab6f2c922b8d56c6a7bda0","dark":"https://mintcdn.com/pcci-docs/sZ7VgIlZ81owdj52/images/favicon.dark.svg?fit=max\u0026auto=format\u0026n=sZ7VgIlZ81owdj52\u0026q=85\u0026s=2803e8629cf0148a397ce03a67b281d6"},"background":{"color":{"light":"#FFFFFF","dark":"#0A0A0A"}},"navbar":{"links":[{"href":"https://docs.prem.io/contact-us","label":"Contact Us"}],"primary":{"type":"button","label":"Dashboard","href":"https://dashboard.prem.io"}},"footer":{"socials":{}},"seo":{"metatags":{"og:image":"/images/og.png","og:title":"Confidential AI API: Secure LLM Inference at Scale | Prem","og:description":"Build on Prem's confidential AI APIs: secure LLM inference with end-to-end encryption, chat completions, and audio transcription. Get your API keys in minutes.","twitter:title":"Confidential AI API: Secure LLM Inference at Scale | Prem","twitter:description":"Build on Prem's confidential AI APIs: secure LLM inference with end-to-end encryption, chat completions, and audio transcription. Get your API keys in minutes.","twitter:image":"/images/og.png"}},"fonts":{"heading":{"family":"Aeonik Pro","weight":500,"source":"fonts/AeonikPro-Medium.woff2","format":"woff2"},"body":{"family":"Inter"}},"styling":{"codeblocks":"system","latex":false},"integrations":{"gtm":{"tagId":"GTM-M8XDSTLM"}},"contextual":{"options":["chatgpt","claude","copy","view","mcp"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"pcci-docs","hasAudioNarration":false,"actualSubdomain":"pcci-docs","customDomains":["docs.prem.io"],"gitSource":{"type":"github","owner":"premai-io","repo":"pcci-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad68c6aece37526c40e6bb8","collectionId":"64585a1d-4f7c-495d-906f-77d0d23f2a56","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad68c6aece37526c40e6bb8"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ad68c6aece37526c40e6bb8","clientVersion":"0.0.3966","searchFilterCounts":[{"language":"default","tag":"Documentation","count":23},{"language":"default","tag":"Guides","count":21},{"language":"default","tag":"API Reference","count":17},{"language":"default","tag":"Core Concepts","count":9},{"language":"default","tag":"Get Started","count":8},{"language":"default","tag":"Endpoints","count":7},{"language":"default","tag":"API Keys","count":6},{"language":"default","tag":"Billing","count":4},{"language":"default","tag":"Support","count":4},{"language":"default","tag":"Handling Errors","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/chat-completions","slug":"/api-reference/chat-completions","pageMetadata":{"openapi":"post /rvenc/chat/completions","title":"Encrypted Chat Completions (RVENC)","description":"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.","href":"/api-reference/chat-completions"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"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.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`typescript-sdk`,children:`TypeScript SDK`}),`\n`,_jsxs(_components.p,{children:[`The SDK is available on GitHub: `,_jsx(_components.a,{href:`https://github.com/premAI-io/api-sdk-ts`,children:`premAI-io/api-sdk-ts`})]}),`\n`,_jsx(Heading,{level:`3`,id:`basic-setup`,children:`Basic Setup`}),`\n`,_jsx(_components.p,{children:`Create a 32-byte KEK. Encode it as 64 hexadecimal characters. Keep the KEK. Reuse it for later requests.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` CLIENT_KEK`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`openssl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rand `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`-hex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Create the client:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` createRvencClient`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@premai/api-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createRvencClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PREM_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` clientKEK:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`CLIENT_KEK`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`pre-generate-keys`,children:`Pre-generate Keys`}),`\n`,_jsx(_components.p,{children:`You can pre-generate encryption keys and reuse them:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` createRvencClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`generateEncryptionKeys`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@premai/api-sdk\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` encryptionKeys`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` generateEncryptionKeys`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createRvencClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PREM_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` clientKEK:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`CLIENT_KEK`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` encryptionKeys`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` requestTimeoutMs:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// optional`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` maxBufferSize:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 20`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// optional`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`non-streaming-requests`,children:`Non-streaming Requests`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"deepseek-v4.1-flash\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Hello!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`streaming-requests`,children:`Streaming Requests`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"deepseek-v4.1-flash\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Hello!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` chunk`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`stdout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`configuration`,children:`Configuration`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Option`}),_jsx(_components.th,{children:`Default`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`apiKey`})}),_jsx(_components.td,{children:`required`}),_jsx(_components.td,{children:`Authorization token`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`encryptionKeys`})}),_jsx(_components.td,{children:`auto-generated`}),_jsxs(_components.td,{children:[`Pre-generated `,_jsx(_components.code,{children:`{ sharedSecret, cipherText }`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`requestTimeoutMs`})}),_jsx(_components.td,{\"data-numeric\":`true`,children:`30000`}),_jsx(_components.td,{children:`Request timeout in ms`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`maxBufferSize`})}),_jsx(_components.td,{\"data-numeric\":`true`,children:`10MB`}),_jsx(_components.td,{children:`Max SSE buffer size`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`openai-compatible-api-server`,children:`OpenAI-Compatible API Server`}),`\n`,_jsx(_components.p,{children:`Run the SDK as a standalone server. The server automatically manages one DEK store for each API key:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bunx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -p`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @premai/api-sdk@1.0.66`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` confidential-proxy`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --kek`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$CLIENT_KEK`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Server runs on http://127.0.0.1:8787`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Use the server with any OpenAI-compatible client:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http://127.0.0.1:8787/v1/chat/completions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer your-api-key\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"model\": \"deepseek-v4.1-flash\", \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}], \"stream\": false}'`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`You can also use the SDK directly in Node.js:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PREM_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` baseURL:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"http://127.0.0.1:8787/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"deepseek-v4.1-flash\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Count to 10\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` chunk`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`stdout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delta`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The server establishes a secure client instance for each API key.`}),`\n`,_jsx(Heading,{level:`2`,id:`reasoning-models`,children:`Reasoning models`}),`\n`,_jsxs(_components.p,{children:[`Reasoning tokens are billed and count against your token rate limits.\nSee `,_jsx(_components.a,{href:`/billing/usage`,children:`Usage`}),` for billing, output-token interaction, and instructions to disable or limit reasoning.`]}),`\n`,_jsxs(_components.p,{children:[`The valid `,_jsx(_components.code,{children:`reasoning_effort`}),` values depend on the model family. See `,_jsx(_components.a,{href:`/models-and-pricing#reasoning-effort`,children:`Models \u0026 Pricing`}),` for the values that each family accepts.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\u003cmodel>\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Hello!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reasoning_effort:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"low\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// reduce reasoning`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`api-reference`,children:`API Reference`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"openapi":"post /rvenc/chat/completions","title":"Encrypted Chat Completions (RVENC)","description":"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.","href":"/api-reference/chat-completions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"TypeScript SDK","slug":"typescript-sdk","depth":2,"children":[{"title":"Basic Setup","slug":"basic-setup","depth":3,"children":[]},{"title":"Pre-generate Keys","slug":"pre-generate-keys","depth":3,"children":[]},{"title":"Non-streaming Requests","slug":"non-streaming-requests","depth":3,"children":[]},{"title":"Streaming Requests","slug":"streaming-requests","depth":3,"children":[]},{"title":"Configuration","slug":"configuration","depth":3,"children":[]}]},{"title":"OpenAI-Compatible API Server","slug":"openai-compatible-api-server","depth":2,"children":[]},{"title":"Reasoning models","slug":"reasoning-models","depth":2,"children":[]},{"title":"API Reference","slug":"api-reference","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/pcci-docs/399ffb6b0ae5cab6/jsonld.js"],"openApiReferenceData":{"operation":{"summary":"Encrypted Chat Completions (RVENC)","description":"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.","operationId":"createRvencChatCompletion","tags":["Chats","dev-api"],"security":["a7031621-49fe-49b5-86f8-e409f1c0c555"],"requestBody":"0ffafa62-591c-4842-8194-d6ac615fd454","responses":{"200":"013f057f-e8d9-4ae0-8efa-bf7b43d84eff","400":"c0415a62-7ff3-4998-acc4-1189ecd7c9d5","401":"30250c30-659b-4241-94fd-dee28bc40ce2","403":"a39e2a44-1006-46b1-97c2-0663470d9fb0","429":"c642105c-6a32-4861-84e7-f0bc814f6d6d"},"method":"post","type":"path","servers":["5cc3bc00-b676-42ab-9eb4-8ae7dc75c0c1"],"path":"/rvenc/chat/completions","baseUrlOptions":["https://gateway.prem.io"],"title":"Encrypted Chat Completions (RVENC)","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Chat completion request with an end-to-end encrypted payload and the key material needed to decrypt it.","properties":{"encryptedInference":{"type":"string","description":"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).","isRequired":true,"uniqueKey":"encryptedInference","typeLabel":"string"},"cipherText":{"type":"string","description":"Cipher text for shared secret generation (ECDH key exchange)","isRequired":true,"uniqueKey":"cipherText","typeLabel":"string"},"nonce":{"type":"string","description":"Nonce used for encrypting the inference payload","isRequired":true,"uniqueKey":"nonce","typeLabel":"string"},"model":{"type":"string","description":"Model identifier to use for completion","uniqueKey":"model","typeLabel":"string"},"stream":{"type":"boolean","default":false,"description":"If true, returns a server-sent events stream. If false, returns JSON with `encryptedResponse` and `nonce`. May also be set inside `encryptedInference`.","uniqueKey":"stream","typeLabel":"boolean"}},"required":["encryptedInference","cipherText","nonce"],"additionalProperties":false,"examples":[{"encryptedInference":"encrypted_inference_payload_data","cipherText":"cipher_text_for_key_exchange","nonce":"nonce_value"}],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"encryptedInference":"encrypted_inference_payload_data","cipherText":"cipher_text_for_key_exchange","nonce":"nonce_value"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"013f057f-e8d9-4ae0-8efa-bf7b43d84eff":{"description":"RVENC chat completion response. Returns JSON when stream is false or omitted (default), or a server-sent events stream when stream is true.","content":{"text/event-stream":{"schema":{"type":"object","description":"Server-sent events (SSE) stream response structure. The actual response is a text stream, but this schema documents the structure for reference.","properties":{"stream":{"type":"string","description":"Server-sent events (SSE) stream with encrypted chat completion chunks. The stream contains four types of events:\n- `event: data` followed by `data: \u003cencrypted_hex_string>` - Encrypted chunk that must be decrypted using the same shared secret and nonce from the request. When decrypted, each chunk matches the structure shown in the `_decryptedChunk` property below (reference only).\n- `event: heartbeat` followed by `data: {\"message\":\"processing\",\"timestamp\":\u003cms>}` - Keep-alive event sent every 5 seconds while waiting for the first inference token. Not encrypted; clients should ignore it.\n- `event: error` followed by `data: \u003cerror_data>` - Error event (can be encrypted or plain JSON). Emitted when inference fails or when no inference data is received within 10 minutes.\n- `event: done` followed by `data: [DONE]` - Stream completion marker\n\nEach encrypted `data:` line contains a hex-encoded string. Decrypt each chunk using XChaCha20-Poly1305 with the shared secret and nonce from your request.","isRequired":true,"uniqueKey":"stream","typeLabel":"string"},"_decryptedChunk":{"type":"object","description":"**Reference only** - This shows the structure that each encrypted chunk should contain when decrypted. Decrypt each chunk in the stream using the same shared secret and nonce from your request to get this structure.","properties":{"id":{"type":"string","description":"A unique identifier for the chat completion. Each chunk has the same id.","examples":["cd9d05b657a041a6a14ab2fc890a7d7e"],"isRequired":true,"uniqueKey":"_decryptedChunk.id","typeLabel":"string"},"object":{"type":"string","enum":["chat.completion.chunk"],"description":"The object type, which is always 'chat.completion.chunk'","examples":["chat.completion.chunk"],"isRequired":true,"uniqueKey":"_decryptedChunk.object","typeLabel":"enum\u003cstring>"},"created":{"type":"integer","description":"The Unix timestamp (in seconds) of when the chat completion was created","examples":[1764004858],"isRequired":true,"uniqueKey":"_decryptedChunk.created","typeLabel":"integer"},"model":{"type":"string","description":"The model used for the chat completion","examples":["openai/gpt-oss-120b"],"isRequired":true,"uniqueKey":"_decryptedChunk.model","typeLabel":"string"},"choices":{"type":"array","description":"A list of chat completion choices. Can contain more than one element if n is greater than 1.","items":{"type":"object","properties":{"index":{"type":"integer","description":"The index of the choice in the list of choices","examples":[0],"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].index","typeLabel":"integer"},"delta":{"type":"object","description":"A chat completion delta generated by streamed model responses. The delta can contain 'role', 'content', 'reasoning_content', 'tool_calls', or be empty {} when finish_reason is set.","properties":{"role":{"oneOf":[{"type":"string","enum":["assistant",null],"description":"The role of the author of this message (only present in first chunk, can be null)","examples":["assistant"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.role.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","enum":["assistant",null],"description":"The role of the author of this message (only present in first chunk, can be null)","examples":["assistant"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.role.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.role","typeLabel":"enum\u003cstring> | null"},"content":{"oneOf":[{"type":"string","description":"The contents of the chunk message (can be null or empty string)","examples":["Hello"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.content.oneOf.0","typeLabel":"string"},{"type":"null","description":"The contents of the chunk message (can be null or empty string)","examples":["Hello"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.content.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.content","typeLabel":"string | null"},"reasoning_content":{"oneOf":[{"type":"string","description":"Reasoning content for models that support reasoning (optional, can be null)","examples":[":"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.reasoning_content.oneOf.0","typeLabel":"string"},{"type":"null","description":"Reasoning content for models that support reasoning (optional, can be null)","examples":[":"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.reasoning_content.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.reasoning_content","typeLabel":"string | null"},"tool_calls":{"oneOf":[{"type":"array","description":"Tool calls made by the assistant (optional, can be null)","items":{"type":"object","uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.tool_calls.oneOf.0.items.[INDEX]","typeLabel":"object"},"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.tool_calls.oneOf.0","typeLabel":"object[]"},{"type":"null","description":"Tool calls made by the assistant (optional, can be null)","items":{"type":"object"},"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.tool_calls.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta.tool_calls","typeLabel":"object[] | null"}},"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].delta","typeLabel":"object"},"logprobs":{"oneOf":[{"type":"object","description":"Log probability information for the choice","default":null,"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].logprobs.oneOf.0","typeLabel":"object"},{"type":"null","description":"Log probability information for the choice","default":null,"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].logprobs.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].logprobs","typeLabel":"object | null"},"finish_reason":{"oneOf":[{"type":"string","enum":["stop","length","tool_calls","content_filter",null],"description":"The reason the model stopped generating tokens. This will be null if the model hasn't finished generating the tokens yet.","examples":["stop"],"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].finish_reason.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","enum":["stop","length","tool_calls","content_filter",null],"description":"The reason the model stopped generating tokens. This will be null if the model hasn't finished generating the tokens yet.","examples":["stop"],"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].finish_reason.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].finish_reason","typeLabel":"enum\u003cstring> | null"},"matched_stop":{"oneOf":[{"type":"string","description":"The stop sequence that was matched (optional, can be null)","default":null,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].matched_stop.oneOf.0","typeLabel":"string"},{"type":"null","description":"The stop sequence that was matched (optional, can be null)","default":null,"uniqueKey":"_decryptedChunk.choices.items.[INDEX].matched_stop.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.choices.items.[INDEX].matched_stop","typeLabel":"string | null"}},"required":["index","delta","logprobs","finish_reason"],"uniqueKey":"_decryptedChunk.choices.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"_decryptedChunk.choices","typeLabel":"object[]"},"system_fingerprint":{"oneOf":[{"type":"string","description":"This fingerprint represents the backend configuration that the model runs with (optional)","examples":["fp_44709d6fcb"],"uniqueKey":"_decryptedChunk.system_fingerprint.oneOf.0","typeLabel":"string"},{"type":"null","description":"This fingerprint represents the backend configuration that the model runs with (optional)","examples":["fp_44709d6fcb"],"uniqueKey":"_decryptedChunk.system_fingerprint.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.system_fingerprint","typeLabel":"string | null"},"usage":{"oneOf":[{"type":"object","description":"Usage statistics for the completion (optional, can be null)","properties":{"prompt_tokens":{"type":"integer","description":"Number of tokens in the prompt","uniqueKey":"_decryptedChunk.usage.oneOf.0.prompt_tokens","typeLabel":"integer"},"completion_tokens":{"type":"integer","description":"Number of tokens in the completion","uniqueKey":"_decryptedChunk.usage.oneOf.0.completion_tokens","typeLabel":"integer"},"total_tokens":{"type":"integer","description":"Total number of tokens used","uniqueKey":"_decryptedChunk.usage.oneOf.0.total_tokens","typeLabel":"integer"}},"default":null,"uniqueKey":"_decryptedChunk.usage.oneOf.0","typeLabel":"object"},{"type":"null","description":"Usage statistics for the completion (optional, can be null)","properties":{"prompt_tokens":{"type":"integer","description":"Number of tokens in the prompt"},"completion_tokens":{"type":"integer","description":"Number of tokens in the completion"},"total_tokens":{"type":"integer","description":"Total number of tokens used"}},"default":null,"uniqueKey":"_decryptedChunk.usage.oneOf.1","typeLabel":"null"}],"uniqueKey":"_decryptedChunk.usage","typeLabel":"object | null"},"error":{"type":"object","description":"Error object if an error occurred (optional)","properties":{"message":{"type":"string","description":"Error message","uniqueKey":"_decryptedChunk.error.message","typeLabel":"string"},"type":{"type":"string","description":"Error type","uniqueKey":"_decryptedChunk.error.type","typeLabel":"string"}},"uniqueKey":"_decryptedChunk.error","typeLabel":"object"}},"required":["id","object","created","model","choices"],"additionalProperties":false,"examples":[{"id":"cd9d05b657a041a6a14ab2fc890a7d7e","object":"chat.completion.chunk","created":1764004858,"model":"openai/gpt-oss-120b","choices":[{"index":0,"delta":{"role":null,"content":null,"reasoning_content":"This ","tool_calls":null},"logprobs":null,"finish_reason":null,"matched_stop":null}],"usage":null},{"id":"cd9d05b657a041a6a14ab2fc890a7d7e","object":"chat.completion.chunk","created":1764004858,"model":"openai/gpt-oss-120b","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":null,"matched_stop":null}],"usage":null},{"id":"cd9d05b657a041a6a14ab2fc890a7d7e","object":"chat.completion.chunk","created":1764004858,"model":"openai/gpt-oss-120b","choices":[{"index":0,"delta":[],"logprobs":null,"finish_reason":"stop","matched_stop":null}],"usage":null}],"readOnly":true,"uniqueKey":"_decryptedChunk","typeLabel":"object"}},"required":["stream"],"examples":[{"stream":"event: data\ndata: a1b2c3d4e5f67890abcdef1234567890abcdef123456...\n\nevent: data\ndata: f6e5d4c3b2a19876543210fedcba9876543210fedcba...\n\nevent: data\ndata: 1234567890abcdef1234567890abcdef1234567890...\n\nevent: done\ndata: [DONE]"},{"stream":"event: heartbeat\ndata: {\"message\":\"processing\",\"timestamp\":1710000000000}\n\nevent: data\ndata: a1b2c3d4e5f67890abcdef1234567890abcdef123456...\n\nevent: error\ndata: {\"error\":{\"message\":\"Error occurred\",\"type\":\"api_error\"}}\n\nevent: done\ndata: [DONE]"}],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"stream":"event: data\ndata: a1b2c3d4e5f67890abcdef1234567890abcdef123456...\n\nevent: data\ndata: f6e5d4c3b2a19876543210fedcba9876543210fedcba...\n\nevent: data\ndata: 1234567890abcdef1234567890abcdef1234567890...\n\nevent: done\ndata: [DONE]"}}},"exampleType":"generated"},"application/json":{"schema":{"type":"object","description":"Encrypted non-streaming RVENC chat completion response. Contains the encrypted completion result that must be decrypted using the shared secret derived from the request's cipherText.","properties":{"encryptedResponse":{"type":"string","description":"Encrypted JSON string containing the chat completion result. Decrypt using XChaCha20-Poly1305 with the shared secret (derived from cipherText) and the response nonce.","isRequired":true,"uniqueKey":"encryptedResponse","typeLabel":"string"},"nonce":{"type":"string","description":"Hex-encoded nonce used for decrypting the encryptedResponse payload.","isRequired":true,"uniqueKey":"nonce","typeLabel":"string"},"usage":{"type":"object","description":"Token usage statistics for the completion request.","properties":{"model":{"type":"string","uniqueKey":"usage.model","typeLabel":"string"},"prompt_tokens":{"type":"integer","uniqueKey":"usage.prompt_tokens","typeLabel":"integer"},"completion_tokens":{"type":"integer","uniqueKey":"usage.completion_tokens","typeLabel":"integer"},"reasoning_tokens":{"type":"integer","uniqueKey":"usage.reasoning_tokens","typeLabel":"integer"},"total_tokens":{"type":"integer","uniqueKey":"usage.total_tokens","typeLabel":"integer"}},"uniqueKey":"usage","typeLabel":"object"}},"required":["encryptedResponse","nonce"],"examples":[{"encryptedResponse":"a1b2c3d4e5f67890abcdef1234567890abcdef123456789012345678901234567890abcdef","nonce":"f6e5d4c3b2a19876543210fedcba9876","usage":{"model":"qwen36-27b","prompt_tokens":10,"completion_tokens":5,"reasoning_tokens":0,"total_tokens":15}}],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"encryptedResponse":"a1b2c3d4e5f67890abcdef1234567890abcdef123456789012345678901234567890abcdef","nonce":"f6e5d4c3b2a19876543210fedcba9876","usage":{"model":"qwen36-27b","prompt_tokens":10,"completion_tokens":5,"reasoning_tokens":0,"total_tokens":15}}}},"exampleType":"generated"}},"exampleType":"generated"},"c0415a62-7ff3-4998-acc4-1189ecd7c9d5":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","enum":[400,401,403,404,429,502,503],"description":"Status code of the response","isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cinteger>"},"error":{"oneOf":[{"type":"string","examples":["Some error message"],"description":"Error message of the response, human readable","isRequired":true,"uniqueKey":"error.oneOf.0","typeLabel":"string"},{"type":"null","examples":["Some error message"],"description":"Error message of the response, human readable","isRequired":true,"uniqueKey":"error.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error","typeLabel":"string | null"},"message":{"type":"null","isRequired":true,"uniqueKey":"message","typeLabel":"null"},"env":{"type":"string","enum":["development","production"],"description":"API environment","isRequired":true,"uniqueKey":"env","typeLabel":"enum\u003cstring>"},"log":{"oneOf":[{"type":"string","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.0","typeLabel":"string"},{"type":"object","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.1","typeLabel":"object"},{"type":"null","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.2","typeLabel":"null"}],"isRequired":true,"uniqueKey":"log","typeLabel":"string | object | null"},"support_id":{"oneOf":[{"type":"string","format":"uuid","examples":["support_uuidv7-something-else"],"description":"Support ID linked to the response, used to identify it when talking with our team","isRequired":true,"uniqueKey":"support_id.oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"null","format":"uuid","examples":["support_uuidv7-something-else"],"description":"Support ID linked to the response, used to identify it when talking with our team","isRequired":true,"uniqueKey":"support_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"support_id","typeLabel":"string\u003cuuid> | null"},"data":{"oneOf":[{"type":"object","description":"Response data containing the requested object","uniqueKey":"data.oneOf.0","typeLabel":"object"},{"type":"null","description":"Response data containing the requested object","uniqueKey":"data.oneOf.1","typeLabel":"null"}],"uniqueKey":"data","typeLabel":"object | null"},"validator":{"oneOf":[{"type":"object","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.0","typeLabel":"object"},{"type":"array","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.1","typeLabel":"array"},{"type":"null","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.2","typeLabel":"null"}],"uniqueKey":"validator","typeLabel":"object | array | null"}},"required":["status","error","message","env","log","support_id"],"additionalProperties":false,"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"status":400,"error":"Some error message","message":null,"env":"development","log":{"request_id":"req_1234567890"},"support_id":"support_uuidv7-something-else","data":{},"validator":{"email":"Invalid email address","password":"Password is required"}}}},"exampleType":"generated"}},"exampleType":"generated"},"30250c30-659b-4241-94fd-dee28bc40ce2":{"description":"Access token is missing or invalid","content":{"application/json":{"schema":{"type":"object","required":["status","error","message","env","log","support_id"],"properties":{"status":{"type":"integer","description":"Status code of the response","enum":[401],"isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cinteger>"},"error":{"oneOf":[{"type":"string","examples":["Some error message"],"description":"Error message of the response, human readable","isRequired":true,"uniqueKey":"error.oneOf.0","typeLabel":"string"},{"type":"null","examples":["Some error message"],"description":"Error message of the response, human readable","isRequired":true,"uniqueKey":"error.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error","typeLabel":"string | null"},"message":{"type":"null","isRequired":true,"uniqueKey":"message","typeLabel":"null"},"env":{"type":"string","enum":["development","production"],"description":"API environment","isRequired":true,"uniqueKey":"env","typeLabel":"enum\u003cstring>"},"log":{"oneOf":[{"type":"string","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.0","typeLabel":"string"},{"type":"object","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.1","typeLabel":"object"},{"type":"null","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.2","typeLabel":"null"}],"isRequired":true,"uniqueKey":"log","typeLabel":"string | object | null"},"support_id":{"oneOf":[{"type":"string","format":"uuid","examples":["support_uuidv7-something-else"],"description":"Support ID linked to the response, used to identify it when talking with our team","isRequired":true,"uniqueKey":"support_id.oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"null","format":"uuid","examples":["support_uuidv7-something-else"],"description":"Support ID linked to the response, used to identify it when talking with our team","isRequired":true,"uniqueKey":"support_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"support_id","typeLabel":"string\u003cuuid> | null"},"data":{"oneOf":[{"type":"object","description":"Response data containing the requested object","uniqueKey":"data.oneOf.0","typeLabel":"object"},{"type":"null","description":"Response data containing the requested object","uniqueKey":"data.oneOf.1","typeLabel":"null"}],"uniqueKey":"data","typeLabel":"object | null"},"validator":{"oneOf":[{"type":"object","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.0","typeLabel":"object"},{"type":"array","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.1","typeLabel":"array"},{"type":"null","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.2","typeLabel":"null"}],"uniqueKey":"validator","typeLabel":"object | array | null"}},"additionalProperties":false,"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"status":401,"error":"Some error message","message":null,"env":"development","log":{"request_id":"req_1234567890"},"support_id":"support_uuidv7-something-else","data":{},"validator":{"email":"Invalid email address","password":"Password is required"}}}},"exampleType":"generated"}},"exampleType":"generated"},"a39e2a44-1006-46b1-97c2-0663470d9fb0":{"description":"You do not have the required permissions to access this resource","content":{"application/json":{"schema":{"type":"object","required":["status","error","message","env","log","support_id"],"properties":{"status":{"type":"integer","description":"Status code of the response","enum":[403],"isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cinteger>"},"error":{"oneOf":[{"type":"string","examples":["Some error message"],"description":"Error message of the response, human readable","isRequired":true,"uniqueKey":"error.oneOf.0","typeLabel":"string"},{"type":"null","examples":["Some error message"],"description":"Error message of the response, human readable","isRequired":true,"uniqueKey":"error.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error","typeLabel":"string | null"},"message":{"type":"null","isRequired":true,"uniqueKey":"message","typeLabel":"null"},"env":{"type":"string","enum":["development","production"],"description":"API environment","isRequired":true,"uniqueKey":"env","typeLabel":"enum\u003cstring>"},"log":{"oneOf":[{"type":"string","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.0","typeLabel":"string"},{"type":"object","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.1","typeLabel":"object"},{"type":"null","examples":[{"request_id":"req_1234567890"},"Some pertinent log message"],"description":"Useful informaiton, not always present, to debug the response","isRequired":true,"uniqueKey":"log.oneOf.2","typeLabel":"null"}],"isRequired":true,"uniqueKey":"log","typeLabel":"string | object | null"},"support_id":{"oneOf":[{"type":"string","format":"uuid","examples":["support_uuidv7-something-else"],"description":"Support ID linked to the response, used to identify it when talking with our team","isRequired":true,"uniqueKey":"support_id.oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"null","format":"uuid","examples":["support_uuidv7-something-else"],"description":"Support ID linked to the response, used to identify it when talking with our team","isRequired":true,"uniqueKey":"support_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"support_id","typeLabel":"string\u003cuuid> | null"},"data":{"oneOf":[{"type":"object","description":"Response data containing the requested object","uniqueKey":"data.oneOf.0","typeLabel":"object"},{"type":"null","description":"Response data containing the requested object","uniqueKey":"data.oneOf.1","typeLabel":"null"}],"uniqueKey":"data","typeLabel":"object | null"},"validator":{"oneOf":[{"type":"object","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.0","typeLabel":"object"},{"type":"array","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.1","typeLabel":"array"},{"type":"null","examples":[{"email":"Invalid email address","password":"Password is required"}],"description":"Validator response object, each key is the field name and value is the error message","uniqueKey":"validator.oneOf.2","typeLabel":"null"}],"uniqueKey":"validator","typeLabel":"object | array | null"}},"additionalProperties":false,"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"status":403,"error":"Some error message","message":null,"env":"development","log":{"request_id":"req_1234567890"},"support_id":"support_uuidv7-something-else","data":{},"validator":{"email":"Invalid email address","password":"Password is required"}}}},"exampleType":"generated"}},"exampleType":"generated"},"c642105c-6a32-4861-84e7-f0bc814f6d6d":{"description":"Too many requests - concurrent stream limit reached","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","examples":[429],"uniqueKey":"status","typeLabel":"integer"},"error":{"type":"string","examples":["You already have an active chat stream. Please wait for it to complete or try again in a few moments."],"uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"status":429,"error":"You already have an active chat stream. Please wait for it to complete or try again in a few moments."}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"a7031621-49fe-49b5-86f8-e409f1c0c555":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Send your access token as header Authorization: Bearer {accessToken}","scopes":[]},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Your API key that starts with sk_live or sk_test. You can create yours at go.prem.io/api-keys.","scopes":[]}}},"servers":{"5cc3bc00-b676-42ab-9eb4-8ae7dc75c0c1":{"url":"https://gateway.prem.io","description":"Production API server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Send your access token as header Authorization: Bearer {accessToken}","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Send your access token as header Authorization: Bearer {accessToken}","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"},{"scheme":{"type":"apiKey","in":"header","name":"Authorization","description":"Your API key that starts with sk_live or sk_test. You can create yours at go.prem.io/api-keys.","scopes":[]},"schema":{"title":"Authorization","type":"string","description":"Your API key that starts with sk_live or sk_test. You can create yours at go.prem.io/api-keys.","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKeyAuth","name":"Authorization"}],"title":"BearerAuth \u0026 ApiKeyAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"pcci-docs","siteName":"Confidential AI API: Secure LLM Inference at Scale | Prem","title":"Confidential AI API: Secure LLM Inference at Scale | Prem","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-13T13:08:54.517Z","originalFileLocation":"api-reference/chat-completions.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"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.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Confidential AI API: Secure LLM Inference at Scale | Prem\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Confidential AI API: Secure LLM Inference at Scale | Prem\">\u003cmeta data-mint-head property=\"og:description\" content=\"Build on Prem\u0026#x27;s confidential AI APIs: secure LLM inference with end-to-end encryption, chat completions, and audio transcription. Get your API keys in minutes.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Confidential AI API: Secure LLM Inference at Scale | Prem\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.prem.io/api-reference/chat-completions\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://pcci-docs.mintlify.app/images/og.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Confidential AI API: Secure LLM Inference at Scale | Prem\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Build on Prem\u0026#x27;s confidential AI APIs: secure LLM inference with end-to-end encryption, chat completions, and audio transcription. Get your API keys in minutes.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://pcci-docs.mintlify.app/images/og.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/pcci-docs/n-sFaqK0eHjogIpf/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Confidential AI API: Secure LLM Inference at Scale | Prem\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5473BE\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.prem.io/api-reference/chat-completions\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/chat-completions.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.prem.io/#organization\",\"name\":\"Confidential AI API: Secure LLM Inference at Scale | Prem\",\"url\":\"https://docs.prem.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/pcci-docs/mrB5JRRZ363u53KU/images/logo/light.svg?fit=max\u0026auto=format\u0026n=mrB5JRRZ363u53KU\u0026q=85\u0026s=7b017ddec6cf9e8ffa387c65ac5dbb79\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.prem.io#website\",\"name\":\"Confidential AI API: Secure LLM Inference at Scale | Prem\",\"url\":\"https://docs.prem.io\",\"publisher\":{\"@id\":\"https://docs.prem.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.prem.io/api-reference/chat-completions#webpage\",\"url\":\"https://docs.prem.io/api-reference/chat-completions\",\"name\":\"Encrypted Chat Completions (RVENC)\",\"description\":\"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.\",\"dateModified\":\"2026-10-13T13:08:54.517Z\",\"isPartOf\":{\"@id\":\"https://docs.prem.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.prem.io/api-reference/chat-completions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.prem.io/api-reference/chat-completions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Confidential AI API: Secure LLM Inference at Scale | Prem\",\"item\":\"https://docs.prem.io\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Encrypted Chat Completions (RVENC)\",\"item\":\"https://docs.prem.io/api-reference/chat-completions\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.prem.io/api-reference/chat-completions#apireference\",\"headline\":\"Encrypted Chat Completions (RVENC)\",\"name\":\"Encrypted Chat Completions (RVENC)\",\"description\":\"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.\",\"url\":\"https://docs.prem.io/api-reference/chat-completions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.prem.io/api-reference/chat-completions#webpage\"},\"image\":\"https://docs.prem.io/images/og.png\",\"dateModified\":\"2026-10-13T13:08:54.517Z\",\"publisher\":{\"@id\":\"https://docs.prem.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.prem.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Confidential AI API: Secure LLM Inference at Scale | Prem\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Confidential AI API: Secure LLM Inference at Scale | Prem","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":""}]},{"anchor":"Guides","icon":"compass","pages":[{"title":"Guides","href":"/agents"}]},{"anchor":"API Reference","icon":"code","groups":[{"group":"Endpoints","icon":"plug","pages":[{"openapi":"post /rvenc/chat/completions","title":"Encrypted Chat Completions (RVENC)","href":"/api-reference/chat-completions"},{"openapi":"post /openai/chat/completions","title":"Create chat completion (OpenAI-compatible)","description":"Create a chat completion. Compatible with the OpenAI Chat Completions API. Not end-to-end encrypted — use `/rvenc/chat/completions` for that.","href":"/api-reference/zdr-chat-completions"},{"openapi":"post /rvenc/audio/transcriptions","title":"Encrypted Audio Transcriptions (RVENC)","href":"/api-reference/audio-transcriptions"},{"openapi":"post /rvenc/audio/translations","title":"Encrypted Audio Translations (RVENC)","href":"/api-reference/audio-translations"},{"openapi":"get /rvenc/models","title":"List available models for confidential inference","href":"/api-reference/list-models"},{"openapi":"get /openai/models","title":"List available models for standard inference","href":"/api-reference/zdr-list-models"},{"title":"Decisions","sidebarTitle":"Decisions (TypeSafe-compatible)","openapi":"post /typesafe/v1/systemone","href":"/api-reference/zdr-decisions"}]},{"group":"API Keys","icon":"key","pages":[{"openapi":"get /developers/api_keys/{id}","title":"Get an API key","href":"/api-reference/api-keys/get-api-key"},{"openapi":"get /analytics/api_keys","title":"Get API key analytics","href":"/api-reference/api-keys/get-api-key-analytics"},{"openapi":"get /developers/api_keys/scopes","title":"List API key scopes","href":"/api-reference/api-keys/list-api-key-scopes"},{"openapi":"get /developers/api_keys","title":"List API keys","href":"/api-reference/api-keys/list-api-keys"},{"openapi":"get /developers/api_keys/requests/{id}","title":"Get API key request","href":"/api-reference/api-keys/get-api-key-request"},{"openapi":"post /developers/api_keys/requests","title":"List API key requests","href":"/api-reference/api-keys/list-api-key-requests"}]},{"group":"Billing","icon":"credit-card","pages":[{"title":"Balance","sidebarTitle":"Balance","icon":"wallet","href":"/billing/balance"},{"title":"Limits","sidebarTitle":"Limits","icon":"gauge","href":"/billing/limits"},{"title":"Payment","sidebarTitle":"Payment","icon":"credit-card","href":"/billing/payment"},{"title":"Usage","sidebarTitle":"Usage","icon":"chart-line","href":"/billing/usage"}]}]},{"anchor":"Support","icon":"life-ring","pages":[{"title":"Support","href":"/glossary"}]}]},"title":"Confidential AI API: Secure LLM Inference at Scale | Prem","buildId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","deploymentId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-DKJwRUt2.js","utils-CWD_VS3u.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-oFjciODD.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-C76WsxC3.js","snippetPresets-DvPMxpX_.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-CuNQfndH.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BVFpVUoF.js","shallow-t59Jg5Kr.js","getApiPlaygroundDisplay-C_JZ4amX.js","CodeSnippet-CLRDnx_h.js","CodeSnippets-C2myU4kc.js","Page-7TwLLapg.js","getPastedJson-B-JaVXw7.js","icon-BA-iDhH3.js","MethodPill-D4qZABFp.js","DuplicateIcon-THIDKO1O.js","createIcon-CYYJwgFd.js","DynamicMarkdown-UGQuxDKp.js","SectionHeading-jYELb23h.js","axios-vUo_bRtp.js","Markdown-DKsLa3wy.js","clsx-CefdjKz2.js","lib--scc4DXi.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-BaREnp3o.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-sgx_0XzF.js"]}