Documentation
API Reference
POST
Embeddings
/v1/embeddings
Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
Interactive Example
Request & Response Example
Headers
Authorization
stringRequired
Bearer token for authentication. Your A4F API key.
Request Body
model
stringRequired
ID of the embedding model to use. Must be a model of type
embeddings
.input
string or array of stringsRequired
The input text or texts to embed.
encoding_format
stringThe format to return the embeddings in. Can be either
float
or base64
.Default: float
dimensions
integerThe number of dimensions the resulting output embeddings should have. Only supported by certain models. Requesting an unsupported dimension will result in an error.
user
stringA unique identifier representing your end-user, for monitoring and abuse detection.
Response Body (200 OK)
object
stringThe object type, which is always 'list'.
data
array of objectsA list of embedding objects.
object
stringThe object type, which is always 'embedding'.
embedding
array of numbers or stringThe embedding vector, which is a list of floats or a base64 encoded string.
index
integerThe index of the embedding in the list.
model
stringThe model ID used for the embedding.
usage
objectUsage statistics for the request.
prompt_tokens
integerThe number of tokens in the input.
total_tokens
integerThe total number of tokens consumed by the request.
Was this page helpful?