Skip to content

Create Text Embeddings

POST/v1/embeddings
API Access

Use the same AudioLab API URL as your other model requests. Confirm the model is enabled and your key has llm.write access. See the Text setup guide.

Overview

Synchronous direct OpenAI and Google Gemini text embeddings.

Routing and provider details

Requires an enabled LLM gateway, a funded workspace, and a key with llm.write. Also accepts /api/v1/embeddings on the LLM gateway. Integration preview until the gateway and API edge are released to the selected environment.

OpenAI accepts up to 32 text inputs, 8192 tokens per input, and 65536 tokens in total. Gemini Embedding 2 accepts one text input, at most 16384 UTF-8 bytes and 8192 tokens, verified through its native countTokens endpoint before inference. Gemini requires the direct-core admission profile. Request bodies are limited to 1 MiB. Token-ID arrays are not yet supported. Vectors use float arrays or little-endian float32 base64; official OpenAI SDK defaults are supported. Dimensions may be shortened for OpenAI 3-series and Gemini Embedding 2. No media, streaming, native Batch API, or automatic retry.

Customer cost is native input cost minus 15%. Fractions smaller than a wallet microdollar accumulate across the workspace, including across API keys; key budgets use exact accrued spend. No per-request minimum fee. Unknown usage retains its spending hold for reconciliation.

Authorization

Authorizationstring · headerRequired

AudioLab API key sent as Bearer <token>. Authentication guide

Parameters

Idempotency-Keyheader · string

Duplicate requests return 409 and never repeat provider inference.

Request Body

application/json
providerobject

Provider preferences for a single-endpoint product.

Show nested fields
data_regionstring | string[]

Route only to endpoints documented as processing in this region: us, eu (which includes EU member states), or a country code such as nl, sg, in or cn. A list matches any of its regions. Endpoints whose region is global or unknown never match; global on its own means no requirement. The request's region narrows the workspace's Data Region and a named router's region policy, and never widens them. Fallbacks keep to it. When no endpoint qualifies, the request is refused with 400 data_region_unavailable, param provider.data_region.

Show nested fields
Option 1: string

string

Option 2: string[]

See the OpenAPI schema for this nested object.

modelstringRequired

Bare native model IDs are also accepted.

Values: "openai/text-embedding-3-small""openai/text-embedding-3-large""openai/text-embedding-ada-002""google/gemini-embedding-2""text-embedding-3-small""text-embedding-3-large""text-embedding-ada-002""gemini-embedding-2"

inputstring | string[]Required
Show nested fields
Option 1: string

string

Option 2: string[]

string

encoding_formatstring

Values: "float""base64"

Default: "float"

dimensionsinteger

3-small permits 1–1536; 3-large permits 1–3072; Gemini Embedding 2 permits 128–3072. Omit for ada-002 (1536).

Minimum 1 · Maximum 3072

userstring

Responses

200Validated vectors and authoritative native input usage, durably settled.
application/json
objectstringRequired
modelstringRequired
dataobject[]Required
Show nested fields
objectstringRequired
indexintegerRequired

Minimum 0

embeddingnumber[] | stringRequired
Show nested fields
Option 1: number[]

See the OpenAPI schema for this nested object.

Option 2: string

See the OpenAPI schema for this nested object.

usageobjectRequired
Show nested fields
prompt_tokensintegerRequired

Minimum 1

total_tokensintegerRequired

Minimum 1

400Request validation failed.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.

401Authentication is missing or invalid.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.

402Credits or billing setup is required.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.

403Authenticated principal lacks permission.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.

404Resource was not found.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.

409Request already has a reservation; provider inference is not repeated.
413Request exceeds the 1 MiB body limit.
429Rate limit exceeded.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.

502Invalid vectors or native provider error.
503No eligible provider endpoint is currently available, or async processing has no healthy worker polling the durable queue.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.