AI Gateway
Embeddings
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
string
required
Your Toolken API key. Validated by the gateway and stripped before forwarding.
string
required
Your provider key in Bearer format (BYOK), e.g.
Bearer sk-.... Forwarded untouched, never stored.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.string
Flat-header shorthand.
X-Toolken-Metadata-Agent: research-agent writes metadata key agent. Equivalent to sending the same key in X-Toolken-Metadata.string
Sets the
feature metadata key. Use to group costs by agent name, workflow, UI surface, or job type.string
Sets the
customer_id metadata key. Use to attribute costs to an end-customer, org slug, or account ID.Body
string
required
Embedding model identifier (e.g.
text-embedding-3-small).string or array
required
Text or array of texts to embed. Forwarded verbatim to the provider.
string
Output format for the embedding vectors. Either
float or base64.Response
string
Always
list.array
Array of embedding objects. Each has
object (embedding), index, and embedding (array of floats).string
The embedding model used.
object
Token counts:
prompt_tokens and total_tokens.