TypeScript
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.nodes.nodesCreateLock({
model: "Focus",
});
// 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.nodes.nodes_create_lock(model="Focus")
# Handle response
print(res)curl --request POST \
--url https://api.atoma.network/v1/nodes/lock \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"max_num_tokens": 1,
"timeout": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', max_num_tokens: 1, timeout: 1})
};
fetch('https://api.atoma.network/v1/nodes/lock', 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/nodes/lock",
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([
'model' => '<string>',
'max_num_tokens' => 1,
'timeout' => 1
]),
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/nodes/lock"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"max_num_tokens\": 1,\n \"timeout\": 1\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/nodes/lock")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"max_num_tokens\": 1,\n \"timeout\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/nodes/lock")
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 \"model\": \"<string>\",\n \"max_num_tokens\": 1,\n \"timeout\": 1\n}"
response = http.request(request)
puts response.read_body{
"node_small_id": 1,
"public_key": "<string>",
"stack_small_id": 1,
"stack_entry_digest": "<string>"
}Nodes
Create a node lock for confidential compute
This endpoint attempts to find a suitable node and retrieve its public key for encryption through a two-step process:
- First, it tries to select an existing node with a public key directly.
- If no node is immediately available, it falls back to finding the cheapest compatible node and acquiring a new stack entry for it.
This endpoint is specifically designed for confidential compute scenarios where requests need to be encrypted before being processed by nodes.
Errors
INTERNAL_SERVER_ERROR- Communication errors or missing node public keysSERVICE_UNAVAILABLE- No nodes available for confidential compute
POST
/
v1
/
nodes
/
lock
TypeScript
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.nodes.nodesCreateLock({
model: "Focus",
});
// 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.nodes.nodes_create_lock(model="Focus")
# Handle response
print(res)curl --request POST \
--url https://api.atoma.network/v1/nodes/lock \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"max_num_tokens": 1,
"timeout": 1
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', max_num_tokens: 1, timeout: 1})
};
fetch('https://api.atoma.network/v1/nodes/lock', 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/nodes/lock",
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([
'model' => '<string>',
'max_num_tokens' => 1,
'timeout' => 1
]),
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/nodes/lock"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"max_num_tokens\": 1,\n \"timeout\": 1\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/nodes/lock")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"max_num_tokens\": 1,\n \"timeout\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/nodes/lock")
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 \"model\": \"<string>\",\n \"max_num_tokens\": 1,\n \"timeout\": 1\n}"
response = http.request(request)
puts response.read_body{
"node_small_id": 1,
"public_key": "<string>",
"stack_small_id": 1,
"stack_entry_digest": "<string>"
}Authorizations
Body
application/json
The model to lock a node for
Request body for creating a node lock
Response
Node DH public key requested successfully
The response body for selecting a node's public key for encryption from a client. The client will use the provided public key to encrypt the request and send it back to the proxy. The proxy will then route this request to the selected node.