API reference · Embeddings
Create embeddings
POSThttps://api.useunbound.ai/v1/embeddings
Turns one or more texts into vectors. Priced by input tokens: the worst case is held before the call and only the tokens the model counted are charged. At most 256 texts and 512 KB in one request.
Headers
AuthorizationrequiredBearer <key>, with a key from Settings → API.Idempotency-KeyAny unique string up to 200 characters. A repeat of a call that is running or has run is refused with 409 instead of being charged twice.
Body
application/json
modelrequiredAn id from
GET /v1/modelswith"type": "embedding".inputrequiredA text, or a list of texts.
dimensionsLength of each vector, for models that can shorten it.
encoding_formatNumbers, or little-endian 32-bit floats in base64.
Response
One vector for each text, in the same order.
objectrequireddatarequiredobjectindexPosition of the text in
input.embeddingThe vector.
modelrequiredusagerequiredprompt_tokenstotal_tokens
Errors
- 400The request is malformed, or a parameter is not supported by the model.
- 401The API key is missing, revoked or expired.
- 402Not enough credit, or the key reached its spending limit. Nothing was charged.
- 403The key does not have the scope this endpoint needs.
- 404The model does not exist or is not available through the API.
- 409This Idempotency-Key was already used.
- 413The request body is larger than 1 MB.
- 429Too many requests for this key. Retry after the number of seconds in the Retry-After header.
- 502The upstream provider failed. The hold was released; you were not charged.
All errors use the envelope described in the introduction. None of them result in a charge.