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