Skip to main content
POST
Pass-through to the provider’s embeddings endpoint. Request and response bodies follow the OpenAI Embeddings schema. The provider is inferred from the model name (e.g. text-embedding-* routes to OpenAI).

Headers

X-Toolken-Key
string
required
Your Toolken API key. Validated by the gateway and stripped before forwarding.
Authorization
string
required
Your provider key in Bearer format (BYOK), e.g. Bearer sk-.... Forwarded untouched, never stored.
X-Toolken-Metadata
string
Primary attribution channel. JSON object of key-value pairs (e.g. {"agent":"research-agent","customer_id":"cust_abc"}). Each key becomes a groupable dimension in the dashboard.
X-Toolken-Metadata-*
string
Flat-header shorthand. X-Toolken-Metadata-Agent: research-agent writes metadata key agent. Equivalent to sending the same key in X-Toolken-Metadata.
X-Toolken-Metadata-Feature
string
Sets the feature metadata key. Use to group costs by agent name, workflow, UI surface, or job type.
X-Toolken-Metadata-Customer-Id
string
Sets the customer_id metadata key. Use to attribute costs to an end-customer, org slug, or account ID.

Body

model
string
required
Embedding model identifier (e.g. text-embedding-3-small).
input
string or array
required
Text or array of texts to embed. Forwarded verbatim to the provider.
encoding_format
string
Output format for the embedding vectors. Either float or base64.

Response

object
string
Always list.
data
array
Array of embedding objects. Each has object (embedding), index, and embedding (array of floats).
model
string
The embedding model used.
usage
object
Token counts: prompt_tokens and total_tokens.