v4

latestOpenAPI 3.1.02026-08-0143190206.8 KB
v1

Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models.

post/v1/embeddings

Request body

dimensionsinteger nullable

The number of dimensions the resulting output embeddings should have.

encoding_formatstring nullable

The format to return the embeddings in. Can be either float or base64.

modelstring

ID of the model to use.

previewboolean nullable

Flag to use the new format of the API.

userstring nullable

A unique identifier representing your end-user, which can help xAI to monitor and detect abuse.

Example request

{
  "model": "v1"
}

Response

Success

modelstring required

Model ID used to create embedding.

objectstring required

The object type of data field, which is always "list".