import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.embeddings.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.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/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "The quick brown fox jumped over the lazy dog",
"model": "intfloat/multilingual-e5-large-instruct",
"dimensions": 1,
"encoding_format": "float",
"user": "user-1234"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: 'The quick brown fox jumped over the lazy dog',
model: 'intfloat/multilingual-e5-large-instruct',
dimensions: 1,
encoding_format: 'float',
user: 'user-1234'
})
};
fetch('https://api.atoma.network/v1/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/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([
'input' => 'The quick brown fox jumped over the lazy dog',
'model' => 'intfloat/multilingual-e5-large-instruct',
'dimensions' => 1,
'encoding_format' => 'float',
'user' => 'user-1234'
]),
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/embeddings"
payload := strings.NewReader("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"intfloat/multilingual-e5-large-instruct\",\n \"dimensions\": 1,\n \"encoding_format\": \"float\",\n \"user\": \"user-1234\"\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/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"intfloat/multilingual-e5-large-instruct\",\n \"dimensions\": 1,\n \"encoding_format\": \"float\",\n \"user\": \"user-1234\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/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 \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"intfloat/multilingual-e5-large-instruct\",\n \"dimensions\": 1,\n \"encoding_format\": \"float\",\n \"user\": \"user-1234\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"embedding": "[0.0023064255, -0.009327292]",
"index": 0,
"object": "embedding"
}
],
"model": "intfloat/multilingual-e5-large-instruct",
"object": "list",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Create embeddings
This endpoint follows the OpenAI API format for generating vector embeddings from input text. 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
import { AtomaSDK } from "atoma-sdk";
const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await atomaSDK.embeddings.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.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/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "The quick brown fox jumped over the lazy dog",
"model": "intfloat/multilingual-e5-large-instruct",
"dimensions": 1,
"encoding_format": "float",
"user": "user-1234"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: 'The quick brown fox jumped over the lazy dog',
model: 'intfloat/multilingual-e5-large-instruct',
dimensions: 1,
encoding_format: 'float',
user: 'user-1234'
})
};
fetch('https://api.atoma.network/v1/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/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([
'input' => 'The quick brown fox jumped over the lazy dog',
'model' => 'intfloat/multilingual-e5-large-instruct',
'dimensions' => 1,
'encoding_format' => 'float',
'user' => 'user-1234'
]),
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/embeddings"
payload := strings.NewReader("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"intfloat/multilingual-e5-large-instruct\",\n \"dimensions\": 1,\n \"encoding_format\": \"float\",\n \"user\": \"user-1234\"\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/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"intfloat/multilingual-e5-large-instruct\",\n \"dimensions\": 1,\n \"encoding_format\": \"float\",\n \"user\": \"user-1234\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atoma.network/v1/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 \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"intfloat/multilingual-e5-large-instruct\",\n \"dimensions\": 1,\n \"encoding_format\": \"float\",\n \"user\": \"user-1234\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"embedding": "[0.0023064255, -0.009327292]",
"index": 0,
"object": "embedding"
}
],
"model": "intfloat/multilingual-e5-large-instruct",
"object": "list",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request object for creating embeddings
Input text to get embeddings for. Can be a string or array of strings. Each input must not exceed the max input tokens for the model
"The quick brown fox jumped over the lazy dog"
ID of the model to use.
"intfloat/multilingual-e5-large-instruct"
The number of dimensions the resulting output embeddings should have.
x >= 0The format to return the embeddings in. Can be "float" or "base64". Defaults to "float"
"float"
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
"user-1234"
Response
Embeddings generated successfully
Response object from creating embeddings
List of embedding objects
Show child attributes
Show child attributes
The model used for generating embeddings
"intfloat/multilingual-e5-large-instruct"
The object type, which is always "list"
"list"
Usage statistics for the request
Show child attributes
Show child attributes