curl --request POST \
--url https://api.nugen.in/api/v3/inference/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "The quick brown fox jumped over the lazy dog",
"model": "model_01kmqm4nrn9fw6r",
"dimensions": 123
}
'import requests
url = "https://api.nugen.in/api/v3/inference/embeddings"
payload = {
"input": "The quick brown fox jumped over the lazy dog",
"model": "model_01kmqm4nrn9fw6r",
"dimensions": 123
}
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: 'The quick brown fox jumped over the lazy dog',
model: 'model_01kmqm4nrn9fw6r',
dimensions: 123
})
};
fetch('https://api.nugen.in/api/v3/inference/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.nugen.in/api/v3/inference/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' => 'model_01kmqm4nrn9fw6r',
'dimensions' => 123
]),
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.nugen.in/api/v3/inference/embeddings"
payload := strings.NewReader("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"model_01kmqm4nrn9fw6r\",\n \"dimensions\": 123\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.nugen.in/api/v3/inference/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"model_01kmqm4nrn9fw6r\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/inference/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\": \"model_01kmqm4nrn9fw6r\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_body{
"created": 1623645497,
"data": [
{
"embedding": [
0.007897645,
-0.006754357,
0.007654689
],
"index": 0
}
],
"id": "nugen-1234",
"model": "model_01kmqm4nrn9fw6r",
"object": "embedding",
"usage": {
"total_tokens": 25
}
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Base model rate limit of 10 requests/minute reached. Use your aligned model for higher throughput."
}Generate Embeddings
Generate dense vector embeddings for input text.
This endpoint creates numerical vector representations (embeddings) of text using specified embedding models. Embeddings are useful for semantic search, clustering, similarity comparisons, and RAG applications.
Request Body:
model: Model ID (required). Use your aligned model id (e.g.model_01kmqm4nrn9fw6r)input: Text or list of texts to embed (required) - Single string or array of strings. Cannot be empty and must not exceed max input tokens for the modeldimensions(optional): Number of dimensions for output embeddings (only applicable for Resizable Matryoshka Embedding models)
Returns:
id: Unique identifier for the responseobject: Object type (alwaysembedding)data: List of embedding objects, each containing:object: Object type (alwaysembedding)embedding: Vector of floats representing the text (length depends on the model)index: Position in the input array
model: Model ID used for generationcreated: Unix timestamp (seconds) when response was generatedusage: Token usage statistics containing:total_tokens: Total number of tokens used by the request
Example Request (Single Text):
POST /api/v3/inference/embeddings
Headers: {"Authorization": "Bearer <api_key>"}
{
"model": "text-embedding-xyz",
"input": "The quick brown fox jumps over the lazy dog"
}
Example Request (Multiple Texts):
POST /api/v3/inference/embeddings
Headers: {"Authorization": "Bearer <api_key>"}
{
"model": "model_01kmqm4nrn9fw6r",
"input": [
"First document for semantic search",
"Second document for clustering",
"Third document for similarity comparison"
]
}
Example Request (With Dimensions):
POST /api/v3/inference/embeddings
Headers: {"Authorization": "Bearer <api_key>"}
{
"model": "model_01kmqm4nrn9fw6r",
"input": "Sample text to embed",
"dimensions": 512
}
Example Response:
{
"id": "embed-abc123xyz",
"object": "embedding",
"data": [
{
"object": "embedding",
"embedding": [0.00658765, -0.008665467, -0.007653789, 0.0023, -0.0091, 0.0125],
"index": 0
}
],
"model": "text-embedding-ada-002",
"created": 1705329600.0,
"usage": {
"total_tokens": 10
}
}
Notes:
- Input must not exceed the maximum input tokens supported by the model
- Input cannot be an empty string
- For batch processing, pass multiple texts as an array to the
inputfield - The embedding vector length varies by model - check model documentation for specifics
- Use
dimensionsparameter only with Matryoshka embedding models that support resizing
curl --request POST \
--url https://api.nugen.in/api/v3/inference/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "The quick brown fox jumped over the lazy dog",
"model": "model_01kmqm4nrn9fw6r",
"dimensions": 123
}
'import requests
url = "https://api.nugen.in/api/v3/inference/embeddings"
payload = {
"input": "The quick brown fox jumped over the lazy dog",
"model": "model_01kmqm4nrn9fw6r",
"dimensions": 123
}
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: 'The quick brown fox jumped over the lazy dog',
model: 'model_01kmqm4nrn9fw6r',
dimensions: 123
})
};
fetch('https://api.nugen.in/api/v3/inference/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.nugen.in/api/v3/inference/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' => 'model_01kmqm4nrn9fw6r',
'dimensions' => 123
]),
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.nugen.in/api/v3/inference/embeddings"
payload := strings.NewReader("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"model_01kmqm4nrn9fw6r\",\n \"dimensions\": 123\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.nugen.in/api/v3/inference/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"The quick brown fox jumped over the lazy dog\",\n \"model\": \"model_01kmqm4nrn9fw6r\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/inference/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\": \"model_01kmqm4nrn9fw6r\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_body{
"created": 1623645497,
"data": [
{
"embedding": [
0.007897645,
-0.006754357,
0.007654689
],
"index": 0
}
],
"id": "nugen-1234",
"model": "model_01kmqm4nrn9fw6r",
"object": "embedding",
"usage": {
"total_tokens": 25
}
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Base model rate limit of 10 requests/minute reached. Use your aligned model for higher throughput."
}Body
An embeddings request in the OpenAI format.
Input text to embed, encoded as a string or a list of strings. To embed multiple inputs in a single request, pass a list of strings. The input must not exceed the max input tokens for the model, cannot be an empty string.
"The quick brown fox jumped over the lazy dog"
Use the expert model id your alignment project returned, once deployed (e.g. model_01kmqm4nrn9fw6r). The same id serves chat completions, responses, messages, embeddings and reranking. Alignment shapes the model's representation space, so aligned embeddings are recommended for domain retrieval.
"model_01kmqm4nrn9fw6r"
Response
Vector embeddings
Embedding vectors for the input, in the OpenAI format.
Was this page helpful?