import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const completion = await atomaSDK.confidentialChat.create({
messages: [
{"role": "developer", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
model: "meta-llama/Llama-3.3-70B-Instruct"
});
console.log(completion.choices[0]);
}
run();
{
"ciphertext": "<string>",
"nonce": "<string>",
"response_hash": "<string>",
"signature": "<string>",
"usage": {
"completion_tokens": 10,
"completion_tokens_details": {
"accepted_prediction_tokens": 10,
"audio_tokens": 0,
"reasoning_tokens": 10,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 10,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 10
},
"total_tokens": 20
}
}Confidential Chat
Create confidential chat completions
This handler processes chat completion requests in a confidential manner, providing additional encryption and security measures for sensitive data processing. It supports both streaming and non-streaming responses while maintaining data confidentiality through AEAD encryption and TEE hardware, for full private AI compute.
Returns
Returns a Result containing either:
- An HTTP response with the chat completion result
- A streaming SSE connection for real-time completions
- An
AtomaProxyErrorerror if the request processing fails
Errors
Returns AtomaProxyError::InvalidBody if:
- The ‘stream’ field is missing or invalid in the payload
Returns AtomaProxyError::InternalError if:
- The inference service request fails
- Response processing encounters errors
- State manager updates fail
Security Features
- Utilizes AEAD encryption for request/response data
- Supports TEE (Trusted Execution Environment) processing
- Implements secure key exchange using X25519
- Maintains confidentiality throughout the request lifecycle
POST
/
v1
/
confidential
/
chat
/
completions
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const completion = await atomaSDK.confidentialChat.create({
messages: [
{"role": "developer", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
model: "meta-llama/Llama-3.3-70B-Instruct"
});
console.log(completion.choices[0]);
}
run();
{
"ciphertext": "<string>",
"nonce": "<string>",
"response_hash": "<string>",
"signature": "<string>",
"usage": {
"completion_tokens": 10,
"completion_tokens_details": {
"accepted_prediction_tokens": 10,
"audio_tokens": 0,
"reasoning_tokens": 10,
"rejected_prediction_tokens": 0
},
"prompt_tokens": 10,
"prompt_tokens_details": {
"audio_tokens": 0,
"cached_tokens": 10
},
"total_tokens": 20
}
}Authorizations
Body
application/json
A request for confidential computation that includes encrypted data and associated cryptographic parameters
Response
Confidential chat completions
Represents a response from a confidential compute request