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

# Create embeddings

> This endpoint follows the OpenAI API format for generating vector embeddings from input text.
The handler receives pre-processed metadata from middleware and forwards the request to
the selected node.

# Returns
* `Ok(Response)` - The embeddings response from the processing node
* `Err(AtomaProxyError)` - An error status code if any step fails

## Errors
* `INTERNAL_SERVER_ERROR` - Processing or node communication failures



## OpenAPI

````yaml cloud-api-reference/openapi.yml post /v1/embeddings
openapi: 3.1.0
info:
  title: atoma-proxy
  description: ''
  license:
    name: Apache-2.0
    identifier: Apache-2.0
  version: 0.1.0
servers:
  - url: https://api.atoma.network
security: []
tags:
  - name: Completions
    description: OpenAI's API completions v1 endpoint
  - name: Confidential Completions
    description: Atoma's API confidential completions v1 endpoint
  - name: Chat
    description: OpenAI's API chat completions v1 endpoint
  - name: Confidential Chat
    description: Atoma's API confidential chat completions v1 endpoint
  - name: Confidential Embeddings
    description: Atoma's API confidential embeddings v1 endpoint
  - name: Confidential Images
    description: Atoma's API confidential images v1 endpoint
  - name: Embeddings
    description: OpenAI's API embeddings v1 endpoint
  - name: Health
    description: Health check
  - name: Images
    description: OpenAI's API images v1 endpoint
  - name: Models
    description: OpenAI's API models v1 endpoint
  - name: Nodes
    description: Nodes Management
  - name: Node Public Key Selection
    description: Node public key selection
paths:
  /v1/embeddings:
    post:
      tags:
        - Embeddings
      summary: Create embeddings
      description: >-
        This endpoint follows the OpenAI API format for generating vector
        embeddings from input text.

        The handler receives pre-processed metadata from middleware and forwards
        the request to

        the selected node.


        # Returns

        * `Ok(Response)` - The embeddings response from the processing node

        * `Err(AtomaProxyError)` - An error status code if any step fails


        ## Errors

        * `INTERNAL_SERVER_ERROR` - Processing or node communication failures
      operationId: embeddings_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmbeddingRequest'
        required: true
      responses:
        '200':
          description: Embeddings generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateEmbeddingResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: typescript
          label: embeddings_create
          source: |-
            import { AtomaSDK } from "atoma-sdk";

            const atomaSDK = new AtomaSDK({
              bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
            });

            async function run() {
              const result = await atomaSDK.embeddings.create({
                model: "intfloat/multilingual-e5-large-instruct",
                input: "The quick brown fox jumped over the lazy dog",
                encoding_format: "float",
              });

              // Handle the result
              console.log(result);
            }

            run();
        - lang: python
          label: embeddings_create
          source: |-
            from atoma_sdk import AtomaSDK
            import os

            with AtomaSDK(
                bearer_auth=os.getenv("ATOMASDK_BEARER_AUTH", ""),
            ) as atoma_sdk:

                res = atoma_sdk.embeddings.create(
                  input_="The quick brown fox jumped over the lazy dog",
                  model="intfloat/multilingual-e5-large-instruct",
                  encoding_format="float"
                )

                print(res)
components:
  schemas:
    CreateEmbeddingRequest:
      type: object
      description: Request object for creating embeddings
      required:
        - model
        - input
      properties:
        dimensions:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            The number of dimensions the resulting output embeddings should
            have.
          minimum: 0
        encoding_format:
          type:
            - string
            - 'null'
          description: |-
            The format to return the embeddings in. Can be "float" or "base64".
            Defaults to "float"
          example: float
        input:
          $ref: '#/components/schemas/EmbeddingInput'
          description: >-
            Input text to get embeddings for. Can be a string or array of
            strings.

            Each input must not exceed the max input tokens for the model
        model:
          type: string
          description: ID of the model to use.
          example: intfloat/multilingual-e5-large-instruct
        user:
          type:
            - string
            - 'null'
          description: >-
            A unique identifier representing your end-user, which can help
            OpenAI to monitor and detect abuse.
          example: user-1234
    CreateEmbeddingResponse:
      type: object
      description: Response object from creating embeddings
      required:
        - object
        - model
        - data
        - usage
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/EmbeddingObject'
          description: List of embedding objects
        model:
          type: string
          description: The model used for generating embeddings
          example: intfloat/multilingual-e5-large-instruct
        object:
          type: string
          description: The object type, which is always "list"
          example: list
        usage:
          $ref: '#/components/schemas/EmbeddingUsage'
          description: Usage statistics for the request
    EmbeddingInput:
      oneOf:
        - type: string
          example: The quick brown fox jumped over the lazy dog
        - type: array
          items:
            type: string
          example: '["The quick brown fox", "jumped over the lazy dog"]'
    EmbeddingObject:
      type: object
      description: Individual embedding object in the response
      required:
        - object
        - embedding
        - index
      properties:
        embedding:
          type: array
          items:
            type: number
            format: float
          description: The embedding vector
          example: '[0.0023064255, -0.009327292]'
        index:
          type: integer
          description: Index of the embedding in the list of embeddings
          example: 0
          minimum: 0
        object:
          type: string
          description: The object type, which is always "embedding"
          example: embedding
    EmbeddingUsage:
      type: object
      description: Usage information for the embeddings request
      required:
        - prompt_tokens
        - total_tokens
      properties:
        prompt_tokens:
          type: integer
          format: int32
          description: Number of tokens in the prompt
          example: 8
          minimum: 0
        total_tokens:
          type: integer
          format: int32
          description: Total tokens used in the request
          example: 8
          minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````