Skip to content

Media & data

Embeddings

Generate vector embeddings for text with models from OpenAI, Qwen, NVIDIA and more. Use them for semantic search, clustering, classification and retrieval-augmented generation (RAG) pipelines.

The endpoint is compatible with the OpenAI SDK: call client.embeddings.create() with your PPQ API key.

Endpoint

POSThttps://api.ppq.ai/v1/embeddings

Parameters

ParameterTypeRequiredDescription
model
string
Yes
Embedding model ID, for example openai/text-embedding-3-small.
input
string | array
Yes
Text to embed: a single string, or an array of strings to embed several texts in one request.
encoding_format
string
No
One of float, base64. Default: float.
dimensions
integer
No
Number of output dimensions. Supported by some models, such as openai/text-embedding-3-small and openai/text-embedding-3-large.

Available models

GET /v1/models?type=embedding returns the current list of embedding models.

curl https://api.ppq.ai/v1/models?type=embedding

Popular embedding models:

ModelProviderMax tokens
openai/text-embedding-3-small
OpenAI
8,191
openai/text-embedding-3-large
OpenAI
8,191

Code examples

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.ppq.ai/v1"
)

response = client.embeddings.create(
    model="openai/text-embedding-3-small",
    input="The quick brown fox jumps over the lazy dog"
)

print(response.data[0].embedding[:5])  # First 5 dimensions
print(f"Total tokens: {response.usage.total_tokens}")

Batch embeddings

Pass an array of strings to embed multiple texts in a single request:

curl -X POST https://api.ppq.ai/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "openai/text-embedding-3-small",
    "input": [
      "First document to embed",
      "Second document to embed",
      "Third document to embed"
    ]
  }'