> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nugen.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Text 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`: Embedding model ID (required) - Name of the model to use for generating embeddings
- `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):**

```json
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):**

```json
POST /api/v3/inference/embeddings
Headers: {"Authorization": "Bearer <api_key>"}

{
  "model": "aligned-model-01kmqm4nrn9fw6r",
  "input": [
    "First document for semantic search",
    "Second document for clustering",
    "Third document for similarity comparison"
  ]
}
```


**Example Request (With Dimensions):**

```json
POST /api/v3/inference/embeddings
Headers: {"Authorization": "Bearer <api_key>"}

{
  "model": "aligned-model-01kmqm4nrn9fw6r",
  "input": "Sample text to embed",
  "dimensions": 512
}
```


**Example Response:**

```json
{
  "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



## OpenAPI

````yaml https://api.nugen.in/openapi-public.json post /api/v3/inference/embeddings
openapi: 3.1.0
info:
  title: Nugen Intelligence API
  description: 'Nugen Intelligence : Powering Specialized Intelligence At Scale'
  version: 25.4.20
servers: []
security: []
paths:
  /api/v3/inference/embeddings:
    post:
      tags:
        - Inference
      summary: Generate Text Embeddings
      description: >-
        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`: Embedding model ID (required) - Name of the model to use for
        generating embeddings

        - `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):**


        ```json

        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):**


        ```json

        POST /api/v3/inference/embeddings

        Headers: {"Authorization": "Bearer <api_key>"}


        {
          "model": "aligned-model-01kmqm4nrn9fw6r",
          "input": [
            "First document for semantic search",
            "Second document for clustering",
            "Third document for similarity comparison"
          ]
        }

        ```



        **Example Request (With Dimensions):**


        ```json

        POST /api/v3/inference/embeddings

        Headers: {"Authorization": "Bearer <api_key>"}


        {
          "model": "aligned-model-01kmqm4nrn9fw6r",
          "input": "Sample text to embed",
          "dimensions": 512
        }

        ```



        **Example Response:**


        ```json

        {
          "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
      operationId: generate_text_embeddings
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbeddingRequestSchema'
        required: true
      responses:
        '200':
          description: Vector embeddings and usage statistics
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    EmbeddingRequestSchema:
      properties:
        input:
          anyOf:
            - items:
                type: string
              type: array
            - type: string
          title: Input
          description: >
            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.
          example: The quick brown fox jumped over the lazy dog
        model:
          type: string
          title: Model
          description: The name of the model used to generate the embedding.
          example: nugen-flash-embed
        dimensions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Dimensions
          description: >-
            (Applicable for only Resizable Matryoshka Embedding models) The
            number of dimensions the resulting output embeddings should have.
      type: object
      required:
        - input
        - model
      title: EmbeddingRequestSchema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````