Skip to main content

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.
We recommend using our official SDKs for a more convenient and type-safe way to interact with the Embeddings API.

Pricing

Pay-as-you-go pricing for all APIs. No subscription required.

Available Models

All models use mean pooling and require no instruction prefix—you can embed text directly without prompt engineering.
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 for details and normalization helpers.
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

Authentication

Set your API key as an environment variable:
Confirm the key is set without printing it:
Never print the key or any part of it. Commands like env, echo $PERPLEXITY_API_KEY, or a prefix or length check leave the key in shell history, logs, and coding-agent transcripts. Read the key from the environment in code and tests, and don’t paste it into fixtures or commit messages.

Next Steps

Standard Embeddings

Embed independent texts, queries, and sentences.

Contextualized Embeddings

Document-aware embeddings for chunks that share context.

Best Practices

Batch processing, caching, RAG patterns, and performance optimization.

Model Cards

See the model cards on HuggingFace.