curl --request POST \
--url https://api.perplexity.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "pplx-embed-v1-0.6b"
}
'{
"object": "list",
"data": [
{
"object": "embedding",
"index": 123,
"embedding": "<string>"
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123,
"cost": {
"input_cost": 123,
"total_cost": 123,
"currency": "USD"
}
}
}Generate embeddings for a list of texts. Use these embeddings for semantic search, clustering, and other machine learning applications.
curl --request POST \
--url https://api.perplexity.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "pplx-embed-v1-0.6b"
}
'{
"object": "list",
"data": [
{
"object": "embedding",
"index": 123,
"embedding": "<string>"
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123,
"cost": {
"input_cost": 123,
"total_cost": 123,
"currency": "USD"
}
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Request body for creating embeddings
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.
1The embedding model to use
pplx-embed-v1-0.6b, pplx-embed-v1-4b 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).
128 <= x <= 2560Output encoding format for embeddings. base64_int8 returns base64-encoded signed int8 values. base64_binary returns base64-encoded packed binary (1 bit per dimension).
base64_int8, base64_binary Successful Response
Was this page helpful?