> ## 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 confidential embeddings

> This endpoint follows the OpenAI API format for generating vector embeddings from input text,
but with confidential processing (through AEAD encryption and TEE hardware).
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/confidential/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/confidential/embeddings:
    post:
      tags:
        - Confidential Embeddings
      summary: Create confidential embeddings
      description: >-
        This endpoint follows the OpenAI API format for generating vector
        embeddings from input text,

        but with confidential processing (through AEAD encryption and TEE
        hardware).

        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: confidential_embeddings_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfidentialComputeRequest'
        required: true
      responses:
        '200':
          description: Confidential embeddings generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfidentialComputeResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: typescript
          label: confidential_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.confidentialEmbeddings.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: confidential_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.confidential_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:
    ConfidentialComputeRequest:
      type: object
      description: >-
        A request for confidential computation that includes encrypted data and
        associated cryptographic parameters
      required:
        - ciphertext
        - stack_small_id
        - nonce
        - salt
        - client_dh_public_key
        - node_dh_public_key
        - plaintext_body_hash
        - model_name
      properties:
        ciphertext:
          type: string
          description: The encrypted payload that needs to be processed (base64 encoded)
        client_dh_public_key:
          type: string
          description: Client's public key for Diffie-Hellman key exchange (base64 encoded)
        model_name:
          type: string
          description: Model name
        node_dh_public_key:
          type: string
          description: Node's public key for Diffie-Hellman key exchange (base64 encoded)
        nonce:
          type: string
          description: Cryptographic nonce used for encryption (base64 encoded)
        num_compute_units:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Number of compute units to be used for the request, for image
            generations,

            as this value is known in advance (the number of pixels to generate)
          minimum: 0
        plaintext_body_hash:
          type: string
          description: >-
            Hash of the original plaintext body for integrity verification
            (base64 encoded)
        salt:
          type: string
          description: Salt value used in key derivation (base64 encoded)
        stack_small_id:
          type: integer
          format: int64
          description: Unique identifier for the small stack being used
          minimum: 0
        stream:
          type:
            - boolean
            - 'null'
          description: Indicates whether this is a streaming request
    ConfidentialComputeResponse:
      type: object
      description: Represents a response from a confidential compute request
      required:
        - ciphertext
        - nonce
      properties:
        ciphertext:
          type: string
          description: Encrypted response body (base64 encoded)
        nonce:
          type: string
          description: Nonce used for encryption (base64 encoded)
        response_hash:
          type:
            - string
            - 'null'
          description: Hash of the response body (base64 encoded)
        signature:
          type:
            - string
            - 'null'
          description: Signature of the response body (base64 encoded)
        usage:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Usage'
              description: Usage statistics for the request
    Usage:
      type: object
      required:
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - completion_tokens_details
        - prompt_tokens_details
      properties:
        completion_tokens:
          type: integer
          format: int32
          description: The number of completion tokens used
          example: 10
          minimum: 0
        completion_tokens_details:
          $ref: '#/components/schemas/CompletionTokensDetails'
          description: The details of the completion tokens
        prompt_tokens:
          type: integer
          format: int32
          description: The number of prompt tokens used
          example: 10
          minimum: 0
        prompt_tokens_details:
          $ref: '#/components/schemas/PromptTokensDetails'
          description: The details of the prompt tokens
        total_tokens:
          type: integer
          format: int32
          description: The total number of tokens used
          example: 20
          minimum: 0
    CompletionTokensDetails:
      type: object
      description: The details of the completion tokens
      required:
        - accepted_prediction_tokens
        - audio_tokens
        - reasoning_tokens
        - rejected_prediction_tokens
      properties:
        accepted_prediction_tokens:
          type: integer
          format: int32
          description: The number of tokens in the completion
          example: 10
          minimum: 0
        audio_tokens:
          type: integer
          format: int32
          description: The number of audio tokens
          example: 0
          minimum: 0
        reasoning_tokens:
          type: integer
          format: int32
          description: The number of reasoning tokens
          example: 10
          minimum: 0
        rejected_prediction_tokens:
          type: integer
          format: int32
          description: The number of rejected prediction tokens
          example: 0
          minimum: 0
    PromptTokensDetails:
      type: object
      required:
        - audio_tokens
        - cached_tokens
      properties:
        audio_tokens:
          type: integer
          format: int32
          description: The number of audio tokens
          example: 0
          minimum: 0
        cached_tokens:
          type: integer
          format: int32
          description: The number of cached tokens
          example: 10
          minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````