Skip to main content
Generate vector embeddings for one or more inputs. Returned in OpenAI’s { data: [{embedding, index}] } shape. Billing is per input token only, no output tokens exist for embeddings.

Request

Parameters

string
required
The embedding model id. Must be deployed in your workspace (e.g. "bge-m3", "mxbai-embed-large").
string | string[]
required
Single string or array of strings to embed. Arrays are processed in a single batched GPU call.
string
default:"float"
"float" (array of numbers) or "base64" (compact, use when wire size matters).

Response

Typical use cases

RAG pipeline

Embed your documents once, store in a vector DB (pgvector, Pinecone, Weaviate), retrieve by cosine similarity at query time.

Semantic dedup

Cluster near-duplicate tickets, support emails, or product reviews.

Classification

Embed labels and queries in the same space, pick nearest-neighbor label.

Hybrid search

Blend BM25 + embedding similarity for better recall than either alone.

Billing

Embeddings are billed per input token only. Rates depend on the model’s parameter size and the deployment mode, see Pricing and credits for the current rate card. Active-tier deployments carry a lower per-token rate in exchange for the reserved-GPU hourly fee.

Batch size limits

The input array can carry up to 2048 strings per request, with a combined token budget that depends on the model: Each input string is also subject to the model’s per-input context limit (typically 512 or 8192 tokens). Inputs longer than the limit are truncated with a warning in the response’s usage block.

Pooling and normalization

The vector returned is the model’s canonical pooled output:
  • BGE family: CLS-token pooling, L2-normalized
  • E5 family: mean pooling over the final hidden state, L2-normalized
  • Nomic / GTE: mean pooling, L2-normalized
Because vectors arrive L2-normalized, cosine similarity reduces to a dot product in downstream code. Most vector databases (pgvector with vector_cosine_ops, Pinecone, Weaviate) handle this transparently.

Idempotency and retries

The endpoint is deterministic for the same deployed model and input. Embeddings are not replay-cached operations today, so an idempotency key does not make retries replayable. Use X-Client-Request-Id when you need to correlate a batch with logs or support tickets:
If you manually retry, assume the repeated request may run again. For cost-sensitive ingestion jobs, keep SDK maxRetries / max_retries at 0 unless your own application layer can deduplicate completed batches. For OpenAI SDK clients, use explicit retry policy instead of relying on broad defaults for large embedding batches:

Next steps

Embeddings + rerank use case

Fuse encoder + cross-encoder reranker on one GPU.

RAG cookbook

End-to-end retrieval with citations.

Rate limits

Per-key budgets and burst behavior.

Errors

Full error code reference.