Endpoint
Request Parameters
string
required
The embedding model ID in
provider/model format. Recommended options:openai/text-embedding-3-small— fast and cost-effective, 1536 dimensions by defaultopenai/text-embedding-3-large— highest accuracy, 3072 dimensions by default
?provider=openai to see all available embedding models.string | array
required
The text or texts to embed. Pass a single string to embed one piece of text, or an array of strings to embed multiple texts in a single API call. Batching is more efficient than making one request per string.
string
default:"float"
The format of the returned embedding values. Use
"float" for a standard JSON array of floating-point numbers (the default), or "base64" for a base64-encoded binary representation that is more compact over the wire.integer
The number of dimensions to include in the output embedding. Supported only by
text-embedding-3 models. Reducing dimensions lowers storage and compute costs at some accuracy cost.Request Example
cURL
Response Fields
string
Always
"list".array
An array of embedding objects, one per input string, in the same order as the input array.
string
The model ID used to generate the embeddings.
integer
The total number of tokens across all input strings.
integer
The same as
prompt_tokens for embeddings — there are no completion tokens.Response Example
The
embedding array is truncated above for readability. In a real response, it contains 1536 floating-point numbers for text-embedding-3-small (or 3072 for text-embedding-3-large). Every value is a number — the "..." placeholder above is not part of the actual JSON.Common Use Cases
- Semantic search — embed your documents once, store the vectors in a vector database, then embed a query and retrieve the most similar documents using nearest-neighbour search.
- Retrieval-augmented generation (RAG) — combine semantic search with a language model to answer questions grounded in your own documents.
- Document clustering — group large collections of text by topic without manually labelling them.
- Duplicate detection — find near-duplicate documents by comparing embedding similarity, even when the wording differs.
Python Example
The example below embeds a list of sentences using theopenai SDK pointed at Portrix, then computes cosine similarity between pairs to find the most semantically related sentences.
Python