# Embeddings API

## Overview

Perplexity's Embeddings API generates high-quality text embeddings for semantic search and retrieval. Choose between **standard embeddings** for independent texts or **contextualized embeddings** for document chunks that share context.

:::callout{intent="info"}
We recommend using our [official SDKs](/guides/perplexity-sdk-overview) for a more convenient and type-safe way to interact with the Embeddings API.
:::

:::card{title="Pricing" href="/guides/getting-started-pricing" icon="receipt" cta="See pricing" horizontal="true"}
Pay-as-you-go pricing for all APIs. No subscription required.
:::

## Available Models

|             Model            | Dimensions | Context | MRL | Quantization | Price ($/1M tokens) |
| :--------------------------: | :--------: | :-----: | :-: | :----------: | :-----------------: |
|     `pplx-embed-v1-0.6b`     |    1024    |   32K   | Yes |  INT8/BINARY |        $0.004       |
|      `pplx-embed-v1-4b`      |    2560    |   32K   | Yes |  INT8/BINARY |        $0.03        |
| `pplx-embed-context-v1-0.6b` |    1024    |   32K   | Yes |  INT8/BINARY |        $0.008       |
|  `pplx-embed-context-v1-4b`  |    2560    |   32K   | Yes |  INT8/BINARY |        $0.05        |

All models use mean pooling and require no instruction prefix—you can embed text directly without prompt engineering.

:::callout{intent="warning"}
Perplexity embeddings are **unnormalized**. Always compare `base64_int8` embeddings via **cosine similarity** (not inner product or L2 distance). Compare `base64_binary` embeddings via **Hamming distance**. See [Best Practices](/guides/embeddings-api-best-practices) for details and normalization helpers.
:::

:::callout{intent="tip"}
**When to use which:**

- **Standard embeddings** (`pplx-embed-v1-*`) - Independent texts, search queries, single sentences
- **Contextualized embeddings** (`pplx-embed-context-v1-*`) - Document chunks that benefit from shared context (e.g., paragraphs from the same article)
:::

## Installation

:::code-group
```bash Python theme={null}
pip install perplexityai
```

```bash TypeScript/JavaScript theme={null}
npm install @perplexity-ai/perplexity_ai
```
:::

## Authentication

Set your API key as an environment variable:

::::tabs
:::tab{title="macOS/Linux"}
```bash theme={null}
export PERPLEXITY_API_KEY="your_api_key_here"
```
:::

:::tab{title="Windows"}
```powershell theme={null}
setx PERPLEXITY_API_KEY "your_api_key_here"
```
:::
::::

## Next Steps

::::card-grid
:::card{title="Standard Embeddings" href="/guides/embeddings-api-standard-embeddings" icon="cube"}
Embed independent texts, queries, and sentences.
:::

:::card{title="Contextualized Embeddings" href="/guides/embeddings-api-contextualized-embeddings" icon="file-lines"}
Document-aware embeddings for chunks that share context.
:::

:::card{title="Best Practices" href="/guides/embeddings-api-best-practices" icon="star"}
Batch processing, caching, RAG patterns, and performance optimization.
:::

:::card{title="Model Cards" href="https://huggingface.co/perplexity-ai" icon="link"}
See the model cards on HuggingFace.
:::
::::

## Related pages

- [Admin & Management](./admin-management-index.md)
- [Agent API](./agent-api-2-index.md)
- [Agent API](./agent-api-index.md)
- [Analytics API](./analytics-api-index.md)
- [Authentication](./authentication-index.md)
- [Changelog](../changelog.md)
- [Cookbook](./cookbook-2-index.md)
- [Embeddings API](./embeddings-api-2-index.md)
- [Embeddings API](./embeddings-api-index.md)
- [Getting Started](./getting-started-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
