Create embeddings
curl --request POST \
--url https://api.naga.ac/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": [
"semantic search",
"vector database"
],
"model": "text-embedding-3-small"
}
'import requests
url = "https://api.naga.ac/v1/embeddings"
payload = {
"input": ["semantic search", "vector database"],
"model": "text-embedding-3-small"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: ['semantic search', 'vector database'], model: 'text-embedding-3-small'})
};
fetch('https://api.naga.ac/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.naga.ac/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' => [
'semantic search',
'vector database'
],
'model' => 'text-embedding-3-small'
]),
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.naga.ac/v1/embeddings"
payload := strings.NewReader("{\n \"input\": [\n \"semantic search\",\n \"vector database\"\n ],\n \"model\": \"text-embedding-3-small\"\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.naga.ac/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"semantic search\",\n \"vector database\"\n ],\n \"model\": \"text-embedding-3-small\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.naga.ac/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\": [\n \"semantic search\",\n \"vector database\"\n ],\n \"model\": \"text-embedding-3-small\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"embedding": [
0.0123,
-0.0034,
0.0912
],
"index": 0,
"object": "embedding"
},
{
"embedding": [
0.0187,
0.0041,
0.0844
],
"index": 1,
"object": "embedding"
}
],
"model": "text-embedding-3-small",
"object": "list",
"usage": {
"prompt_tokens": 6,
"total_tokens": 6
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}Embeddings
Create embeddings
Convert one or more text inputs into vector embeddings.
POST
/
v1
/
embeddings
Create embeddings
curl --request POST \
--url https://api.naga.ac/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": [
"semantic search",
"vector database"
],
"model": "text-embedding-3-small"
}
'import requests
url = "https://api.naga.ac/v1/embeddings"
payload = {
"input": ["semantic search", "vector database"],
"model": "text-embedding-3-small"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: ['semantic search', 'vector database'], model: 'text-embedding-3-small'})
};
fetch('https://api.naga.ac/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.naga.ac/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' => [
'semantic search',
'vector database'
],
'model' => 'text-embedding-3-small'
]),
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.naga.ac/v1/embeddings"
payload := strings.NewReader("{\n \"input\": [\n \"semantic search\",\n \"vector database\"\n ],\n \"model\": \"text-embedding-3-small\"\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.naga.ac/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"semantic search\",\n \"vector database\"\n ],\n \"model\": \"text-embedding-3-small\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.naga.ac/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\": [\n \"semantic search\",\n \"vector database\"\n ],\n \"model\": \"text-embedding-3-small\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"embedding": [
0.0123,
-0.0034,
0.0912
],
"index": 0,
"object": "embedding"
},
{
"embedding": [
0.0187,
0.0041,
0.0844
],
"index": 1,
"object": "embedding"
}
],
"model": "text-embedding-3-small",
"object": "list",
"usage": {
"prompt_tokens": 6,
"total_tokens": 6
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}{
"error": {
"message": "The request body is invalid.",
"type": "invalid_request_error"
}
}Authorizations
bearerAuthxApiKeyAuth
Primary authentication for inference endpoints. Send your Naga API key as Authorization: Bearer <api-key>.
Body
application/json
Embedding model identifier.
Example:
"text-embedding-3-small"
Single input or batch of inputs to embed.
Optional target embedding dimension when supported by the model.
Return vectors as JSON floats or base64-encoded binary data.
Available options:
float, base64 ⌘I