Inference API
Embeddings
Create embeddings
/v1/embeddings
Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models.
Request Body
Response Body
dataarray<object>A list of embedding objects.
modelstringModel ID used to create embedding.
objectstringThe object type of `data` field, which is always `"list"`.
"{\n \"input\": [\"This is an example content to embed...\"],\n \"model\": \"v1\",\n \"encoding_format\": \"float\"\n }"{
"object": "list",
"model": "v1",
"data": [
{
"index": 0,
"embedding": [
0.01567895,
0.063257694,
0.045925662
],
"object": "embedding"
}
],
"usage": {
"prompt_tokens": 1,
"total_tokens": 1
}
}List embedding models
/v1/embedding-models
List all embedding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, fingerprint and alias(es).
Response Body
modelsarray<object>Array of available embedding models.
No parameters.{
"models": [
{
"id": "v1",
"fingerprint": "fp_df37966059",
"created": 1725148800,
"object": "model",
"owned_by": "xai",
"version": "0.1.0",
"input_modalities": [
"text"
],
"prompt_text_token_price": 100,
"prompt_image_token_price": 0,
"aliases": []
}
]
}Get embedding model
/v1/embedding-models/{model_id}
Get full information about an embedding model with its model_id.
Path Parameters
model_idstringID of the model to get.
Response Body
aliasesarray<string>Alias ID(s) of the model that user can use in a request's model field.
createdintegerModel creation time in Unix timestamp.
fingerprintstringFingerprint of the xAI system configuration hosting the model.
idstringModel ID. Obtainable from <https://console.x.ai/team/default/models> or <https://docs.x.ai/docs/models>.
input_modalitiesarray<string>The input modalities supported by the model.
objectstringObject type, should be model.
output_modalitiesarray<string>The output modalities supported by the model.
owned_bystringOwner of the model.
prompt_image_token_priceintegerPrice of the prompt image token in USD cents per million token.
prompt_text_token_priceintegerPrice of the prompt text token in USD cents per million token.
versionstringVersion of the model.
No parameters.{
"id": "v1",
"created": 1725148800,
"object": "model",
"owned_by": "xai",
"version": "0.1.0",
"input_modalities": [
"text"
],
"prompt_text_token_price": 10,
"prompt_image_token_price": 0,
"aliases": []
}