Skip to main content
POST
https://api.naga.ac
/
v1
/
embeddings
Embeddings
curl --request POST \
  --url https://api.naga.ac/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "input": {},
  "dimensions": 123,
  "encoding_format": "<string>"
}
'
{
  "object": "<string>",
  "data": [
    {
      "object": "<string>",
      "embedding": [
        {}
      ],
      "index": 123
    }
  ],
  "model": "<string>",
  "usage": {
    "prompt_tokens": 123,
    "total_tokens": 123
  }
}

Request parameters

model
string
required
Embedding model ID.
input
string | array
required
Input text to embed, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays.
dimensions
integer
The number of dimensions the resulting output embeddings should have. Only supported in some models.
encoding_format
string
default:"float"
The format to return the embeddings in. Can be either float or base64.

Example Request

from openai import OpenAI

client = OpenAI(base_url="https://api.naga.ac/v1", api_key="YOUR_API_KEY")

resp = client.embeddings.create(
    model="text-embedding-3-small",
    input=[
        "The food was delicious!",
        "Service could be faster.",
    ],  # dimensions=512, # if supported # encoding_format="base64",
)
print(resp)

Response

Returns embedding vectors per input. The structure is compatible with OpenAI’s embeddings API. When encoding_format="float", vectors are float arrays; with "base64", vectors are base64-encoded.

Response Fields

object
string
Always “list”
data
array
Array of embedding objects
model
string
The model used for embeddings
usage
object
Token usage information