Embeddings
Create embeddings with OpenAI, Gemini, Mistral, Fireworks, Together and Bedrock models through one API.
The gateway serves OpenAI’s Embeddings API at /v1/embeddings. The model routes to any provider that embeds, on your own key or Respan’s credits, and the answer comes back in OpenAI’s shape.
Pick a model: filter by output type embeddings on the model catalog , or read Models.
Quickstart
curl https://gateway.respan.ai/v1/embeddings \
-H "Authorization: Bearer $RESPAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": ["How do I reset my password?", "Where is my order?"]
}'Options
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | required | The embedding model. |
input | string, array of strings, or array of token ids | required | The text to embed. |
dimensions | integer | model default | Output size, where the model supports it. |
encoding_format | string | float | float or base64. |
Send the request as JSON. A form-encoded body is refused with 400.
Providers
| Provider | Embeddings |
|---|---|
| OpenAI | Yes |
| Gemini | Yes |
| Mistral | Yes |
| Fireworks | Yes |
| Together | Yes |
| AWS Bedrock | Yes, Cohere and Titan embedding models |
OpenRouter models are not served for embeddings, because OpenRouter’s vendor on the gateway speaks chat only.
Respan parameters
Add customer_identifier, metadata and the other Respan parameters in the body (or extra_body) or the X-Data-Respan-Params header, as on chat. Tagging embedding calls with the same customer as their chat calls lets you see a customer’s full spend. See Respan parameters.
result = client.embeddings.create(
model="text-embedding-3-small",
input="Where is my order?",
extra_body={"customer_identifier": "user_123"},
)Embedding requests are not redacted, so an organization with PII redaction on is refused.
Pricing and logs
- Each call is one trace with one
embeddingrow, priced on its input tokens. The row keeps the input texts (input_textorinput_texts), not the vectors. - Before a call on Respan’s credits is sent, the gateway holds credits for the input at the model’s input rate.
- On Respan’s credits, a model without an input price is refused with
400before anything is held or sent. - An answer on Respan’s credits that reports no input tokens is refused with
502 no_billable_usageand charged nothing. - Embeddings pass the same checks as chat (limit policies, RPM, key usage cap, customer budgets), with no TPM limit and no customer rate limit.
Next steps
- Text: routing and billing basics.
- Budgets and limits: cap spend per key or customer.
- Respan parameters: tag calls with a customer and metadata.
- Logs: find each embedding row.