---
title: "Create Embeddings"
method: POST
path: "/v1/embeddings"
---

# Create Embeddings

`POST /v1/embeddings`

Generate embeddings for a list of texts. Use these embeddings for semantic search, clustering, and other machine learning applications.

## Request body

- EmbeddingsRequest — Request body for creating embeddings
  - `input` union, required — Input text to embed, encoded as a string or array of strings. Maximum 512 texts per request. Each input must not exceed 32K tokens. All inputs in a single request must not exceed 120,000 tokens combined. Empty strings are not allowed.
    - string
    - string[]
  - `model` 'pplx-embed-v1-0.6b' | 'pplx-embed-v1-4b', required — The embedding model to use
  - `dimensions` integer — Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for pplx-embed-v1-0.6b, 128-2560 for pplx-embed-v1-4b. Defaults to full dimensions (1024 or 2560).
  - `encoding_format` 'base64_int8' | 'base64_binary' — Output encoding format for embeddings. base64_int8 returns base64-encoded signed int8 values. base64_binary returns base64-encoded packed binary (1 bit per dimension).

## Response `200`

Successful Response

- EmbeddingsResponse — Response body for embeddings request
  - `object` string — The object type
  - `data` EmbeddingObject[] — List of embedding objects
    - `object` string — The object type
    - `index` integer — The index of the input text this embedding corresponds to
    - `embedding` string — Base64-encoded embedding vector. For base64_int8: decode to signed int8 array (length = dimensions). For base64_binary: decode to packed bits (length = dimensions / 8 bytes).
  - `model` string — The model used to generate embeddings
  - `usage` EmbeddingsUsage — Token usage for the embeddings request
    - `prompt_tokens` integer — Number of tokens in the input texts
    - `total_tokens` integer — Total number of tokens processed
    - `cost` object — Cost breakdown for the request
      - `input_cost` number — Cost for input tokens in USD
      - `total_cost` number — Total cost for the request in USD
      - `currency` 'USD' — Currency of the cost values

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/perplexityai/apis/perplexity-ai-api.md) · [All operations](https://skmtc.net/perplexityai/apis/perplexity-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/perplexityai/perplexity-ai-api/versions/bcca72d3b564/schema)
