TypeScript
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.confidentialEmbeddings.create({
model: "intfloat/multilingual-e5-large-instruct",
input: "The quick brown fox jumped over the lazy dog",
encoding_format: "float",
});
// Handle the result
console.log(result);
}
run();from atoma_sdk import AtomaSDK
import os
with AtomaSDK(
bearer_auth=os.getenv("ATOMASDK_BEARER_AUTH", ""),
) as atoma_sdk:
res = atoma_sdk.confidential_embeddings.create(
input_="The quick brown fox jumped over the lazy dog",
model="intfloat/multilingual-e5-large-instruct",
encoding_format="float"
)
print(res)curl --request POST \
--url https://api.atoma.network/v1/confidential/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ciphertext": "<string>",
"client_dh_public_key": "<string>",
"model_name": "<string>",
"node_dh_public_key": "<string>",
"nonce": "<string>",
"plaintext_body_hash": "<string>",
"salt": "<string>",
"stack_small_id": 1,
"num_compute_units": 1,
"stream": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ciphertext: '<string>',
client_dh_public_key: '<string>',
model_name: '<string>',
node_dh_public_key: '<string>',
nonce: '<string>',
plaintext_body_hash: '<string>',
salt: '<string>',
stack_small_id: 1,
num_compute_units: 1,
stream: true
})
};
fetch('https://api.atoma.network/v1/confidential/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.atoma.network/v1/confidential/embeddings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ciphertext' => '<string>',
'client_dh_public_key' => '<string>',
'model_name' => '<string>',
'node_dh_public_key' => '<string>',
'nonce' => '<string>',
'plaintext_body_hash' => '<string>',
'salt' => '<string>',
'stack_small_id' => 1,
'num_compute_units' => 1,
'stream' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.atoma.network/v1/confidential/embeddings"
payload := strings.NewReader("{\n \"ciphertext\": \"<string>\",\n \"client_dh_public_key\": \"<string>\",\n \"model_name\": \"<string>\",\n \"node_dh_public_key\": \"<string>\",\n \"nonce\": \"<string>\",\n \"plaintext_body_hash\": \"<string>\",\n \"salt\": \"<string>\",\n \"stack_small_id\": 1,\n \"num_compute_units\": 1,\n \"stream\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.atoma.network/v1/confidential/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ciphertext\": \"<string>\",\n \"client_dh_public_key\": \"<string>\",\n \"model_name\": \"<string>\",\n \"node_dh_public_key\": \"<string>\",\n \"nonce\": \"<string>\",\n \"plaintext_body_hash\": \"<string>\",\n \"salt\": \"<string>\",\n \"stack_small_id\": 1,\n \"num_compute_units\": 1,\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/confidential/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ciphertext\": \"<string>\",\n \"client_dh_public_key\": \"<string>\",\n \"model_name\": \"<string>\",\n \"node_dh_public_key\": \"<string>\",\n \"nonce\": \"<string>\",\n \"plaintext_body_hash\": \"<string>\",\n \"salt\": \"<string>\",\n \"stack_small_id\": 1,\n \"num_compute_units\": 1,\n \"stream\": true\n}"
response = http.request(request)
puts response.read_body{
"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 Embeddings
Create confidential embeddings
This endpoint follows the OpenAI API format for generating vector embeddings from input text, but with confidential processing (through AEAD encryption and TEE hardware). The handler receives pre-processed metadata from middleware and forwards the request to the selected node.
Returns
Ok(Response)- The embeddings response from the processing nodeErr(AtomaProxyError)- An error status code if any step fails
Errors
INTERNAL_SERVER_ERROR- Processing or node communication failures
POST
/
v1
/
confidential
/
embeddings
TypeScript
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.confidentialEmbeddings.create({
model: "intfloat/multilingual-e5-large-instruct",
input: "The quick brown fox jumped over the lazy dog",
encoding_format: "float",
});
// Handle the result
console.log(result);
}
run();from atoma_sdk import AtomaSDK
import os
with AtomaSDK(
bearer_auth=os.getenv("ATOMASDK_BEARER_AUTH", ""),
) as atoma_sdk:
res = atoma_sdk.confidential_embeddings.create(
input_="The quick brown fox jumped over the lazy dog",
model="intfloat/multilingual-e5-large-instruct",
encoding_format="float"
)
print(res)curl --request POST \
--url https://api.atoma.network/v1/confidential/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ciphertext": "<string>",
"client_dh_public_key": "<string>",
"model_name": "<string>",
"node_dh_public_key": "<string>",
"nonce": "<string>",
"plaintext_body_hash": "<string>",
"salt": "<string>",
"stack_small_id": 1,
"num_compute_units": 1,
"stream": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ciphertext: '<string>',
client_dh_public_key: '<string>',
model_name: '<string>',
node_dh_public_key: '<string>',
nonce: '<string>',
plaintext_body_hash: '<string>',
salt: '<string>',
stack_small_id: 1,
num_compute_units: 1,
stream: true
})
};
fetch('https://api.atoma.network/v1/confidential/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.atoma.network/v1/confidential/embeddings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ciphertext' => '<string>',
'client_dh_public_key' => '<string>',
'model_name' => '<string>',
'node_dh_public_key' => '<string>',
'nonce' => '<string>',
'plaintext_body_hash' => '<string>',
'salt' => '<string>',
'stack_small_id' => 1,
'num_compute_units' => 1,
'stream' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.atoma.network/v1/confidential/embeddings"
payload := strings.NewReader("{\n \"ciphertext\": \"<string>\",\n \"client_dh_public_key\": \"<string>\",\n \"model_name\": \"<string>\",\n \"node_dh_public_key\": \"<string>\",\n \"nonce\": \"<string>\",\n \"plaintext_body_hash\": \"<string>\",\n \"salt\": \"<string>\",\n \"stack_small_id\": 1,\n \"num_compute_units\": 1,\n \"stream\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.atoma.network/v1/confidential/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ciphertext\": \"<string>\",\n \"client_dh_public_key\": \"<string>\",\n \"model_name\": \"<string>\",\n \"node_dh_public_key\": \"<string>\",\n \"nonce\": \"<string>\",\n \"plaintext_body_hash\": \"<string>\",\n \"salt\": \"<string>\",\n \"stack_small_id\": 1,\n \"num_compute_units\": 1,\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/confidential/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ciphertext\": \"<string>\",\n \"client_dh_public_key\": \"<string>\",\n \"model_name\": \"<string>\",\n \"node_dh_public_key\": \"<string>\",\n \"nonce\": \"<string>\",\n \"plaintext_body_hash\": \"<string>\",\n \"salt\": \"<string>\",\n \"stack_small_id\": 1,\n \"num_compute_units\": 1,\n \"stream\": true\n}"
response = http.request(request)
puts response.read_body{
"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 embeddings generated successfully
Represents a response from a confidential compute request