Inference
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 model
- dimensions (optional): Number of dimensions for output embeddings (only applicable for Resizable Matryoshka Embedding models)
Returns:
- id: Unique identifier for the response
- object: Object type (always embedding)
- data: List of embedding objects, each containing:
- object: Object type (always embedding)
- embedding: Vector of floats representing the text (length depends on the model)
- index: Position in the input array
- model: Model ID used for generation
- created: Unix timestamp (seconds) when response was generated
- usage: 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 input field
- The embedding vector length varies by model - check model documentation for specifics
- Use dimensions parameter only with Matryoshka embedding models that support resizing
post/api/v3/inference/embeddings
Request
- Base URLhttps://api.nugen.in
- AuthHTTP bearer
Request body
Example request
{
"model": "model_01kmqm4nrn9fw6r"
}Response
Vector embeddings
Example response
{
"created": 1623645497,
"data": [
{
"embedding": [
0.007897645,
-0.006754357,
0.007654689
],
"index": 0
}
],
"id": "nugen-1234",
"model": "model_01kmqm4nrn9fw6r",
"object": "embedding",
"usage": {
"total_tokens": 25
}
}Changes
No recorded changes to this operation across all 1 revision of this API.