Embeddings
Convert text into vectors for similarity search and retrieval.
Before You Begin
Embeddings represent text as numeric vectors. Store document vectors in your search system, embed a query with the same model, and compare the query vector against the stored vectors to retrieve candidates.
Use the same API URL and workspace key as other model requests. Embeddings require an enabled embedding model, llm.write, and available workspace credits. Send requests to /v1/embeddings.
Embed Text
Select an enabled embedding model and submit a small input. This example requests float vectors with a reduced dimension supported by the selected model:
curl --fail --show-error --request POST \
--url "$AUDIOLAB_API_URL/v1/embeddings" \
--header "Authorization: Bearer $AUDIOLAB_API_KEY" \
--header 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
--header 'Content-Type: application/json' \
--data '{
"model": "openai/text-embedding-3-small",
"input": [
"Build search with AudioLab."
],
"dimensions": 64,
"encoding_format": "float"
}'A successful response includes data, whose entries contain an input index and an embedding, plus token usage. Match results to the original inputs by index. With encoding_format: "float", each embedding is an array of numbers.
Keep Your Search Index Consistent
Record the model ID and dimensions with your vector index. Use the same model and dimensions for documents and queries. When you change either, re-embed the indexed documents instead of mixing incompatible vectors.
Input counts, token limits, supported dimensions, and base64 encoding differ by model. Consult the Embeddings reference before batching inputs. This endpoint does not support streaming or the provider’s native Batch API.
After retrieving a set of candidates, use Reranking when you want an additional query-specific relevance order.