---
title: "Create confidential embeddings"
method: POST
path: "/v1/confidential/embeddings"
tags: ["Confidential Embeddings"]
---

# Create confidential embeddings

`POST /v1/confidential/embeddings`

## Request

- Base URL: `https://api.atoma.network`
- URL: `https://api.atoma.network/v1/confidential/embeddings`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/atomaai/apis/atoma-proxy/docs/v1/confidential/embeddings/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Request body

- ConfidentialComputeRequest: A request for confidential computation that includes encrypted data and associated cryptographic parameters
  - `ciphertext` string, required: The encrypted payload that needs to be processed (base64 encoded)
  - `client_dh_public_key` string, required: Client's public key for Diffie-Hellman key exchange (base64 encoded)
  - `model_name` string, required: Model name
  - `node_dh_public_key` string, required: Node's public key for Diffie-Hellman key exchange (base64 encoded)
  - `nonce` string, required: Cryptographic nonce used for encryption (base64 encoded)
  - `num_compute_units` integer, nullable: 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)
  - `plaintext_body_hash` string, required: Hash of the original plaintext body for integrity verification (base64 encoded)
  - `salt` string, required: Salt value used in key derivation (base64 encoded)
  - `stack_small_id` integer, required: Unique identifier for the small stack being used
  - `stream` boolean, nullable: Indicates whether this is a streaming request

## Response `200`

Confidential embeddings generated successfully

- ConfidentialComputeResponse: Represents a response from a confidential compute request
  - `ciphertext` string, required: Encrypted response body (base64 encoded)
  - `nonce` string, required: Nonce used for encryption (base64 encoded)
  - `response_hash` string, nullable: Hash of the response body (base64 encoded)
  - `signature` string, nullable: Signature of the response body (base64 encoded)
  - `usage` Usage
    - `completion_tokens` integer, required: The number of completion tokens used
    - `completion_tokens_details` CompletionTokensDetails, required: The details of the completion tokens
      - `accepted_prediction_tokens` integer, required: The number of tokens in the completion
      - `audio_tokens` integer, required: The number of audio tokens
      - `reasoning_tokens` integer, required: The number of reasoning tokens
      - `rejected_prediction_tokens` integer, required: The number of rejected prediction tokens
    - `prompt_tokens` integer, required: The number of prompt tokens used
    - `prompt_tokens_details` PromptTokensDetails, required
      - `audio_tokens` integer, required: The number of audio tokens
      - `cached_tokens` integer, required: The number of cached tokens
    - `total_tokens` integer, required: The total number of tokens used

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `500`: Internal server error

## Changes

- **2025-05-12** `f0bf5a2dde0f`: 2 breaking, 7 info
  - the `usage/oneOf[#/components/schemas/Usage]/completion_tokens` response's property type changed from `integer, null` to `integer`, and format from `int64` to `int32` for status `200`
  - the `usage/oneOf[#/components/schemas/Usage]/completion_tokens_details` response's property type changed from no type to `object` for status `200`
  - the response property `usage/oneOf[#/components/schemas/Usage]/completion_tokens` became required for the status `200`
  - the response property `usage/oneOf[#/components/schemas/Usage]/completion_tokens_details` became required for the status `200`
  - …5 more
- **2025-01-25** `d714acb641bd`: 1 info
  - endpoint added
- **2024-12-06** `45e3254839bd`: 1 breaking
  - api path removed without deprecation

[Operation history](https://skmtc.dev/atomaai/apis/atoma-proxy/changes/v1/confidential/embeddings/post.md)

---

[API](https://skmtc.dev/atomaai/apis/atoma-proxy.md) - [All operations](https://skmtc.dev/atomaai/apis/atoma-proxy/llms.txt) - [OpenAPI document](https://skmtc.dev/atomaai/apis/atoma-proxy/revisions/07694b7228b0?raw)
