The text content to be embedded, can be a string or an array of strings for fast processing in bulk.













Embeddings Endpoints
Embeddings API.












Examples
Real world code examples
Embeddings
POST /v1/embeddings
Embeddings
encoding_format
input
model
The ID of the model to be used for embedding.
output_dimension
The dimension of the output embeddings when feature available. If not provided, a default output dimension will be used.
output_dtype
200
Successful Response
Playground
Test the endpoints live
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.embeddings.create({
model: "mistral-embed",
inputs: [
"Embed this sentence.",
"As well as this one.",
],
});
console.log(result);
}
run();
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: "MISTRAL_API_KEY",
});
async function run() {
const result = await mistral.embeddings.create({
model: "mistral-embed",
inputs: [
"Embed this sentence.",
"As well as this one.",
],
});
console.log(result);
}
run();
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.embeddings.create(model="mistral-embed", inputs=[
"Embed this sentence.",
"As well as this one.",
])
# Handle response
print(res)
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.embeddings.create(model="mistral-embed", inputs=[
"Embed this sentence.",
"As well as this one.",
])
# Handle response
print(res)
curl https://api.mistral.ai/v1/embeddings \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-d '{
"input": "ipsum eiusmod",
"model": "mistral-embed"
}'
curl https://api.mistral.ai/v1/embeddings \
-X POST \
-H 'Authorization: Bearer YOUR_APIKEY_HERE' \
-d '{
"input": "ipsum eiusmod",
"model": "mistral-embed"
}'
200
{
"data": [
{
"embedding": [
-0.016632080078125,
0.0701904296875,
0.03143310546875,
0.01309967041015625,
0.0202789306640625
],
"index": 0,
"object": "embedding"
},
{
"embedding": [
-0.0230560302734375,
0.039337158203125,
0.0521240234375,
-0.0184783935546875,
0.034271240234375
],
"index": 1,
"object": "embedding"
}
],
"model": "mistral-embed",
"object": "list",
"usage": {
"prompt_tokens": 15,
"completion_tokens": 0,
"total_tokens": 15,
"prompt_audio_seconds": null
}
}
{
"data": [
{
"embedding": [
-0.016632080078125,
0.0701904296875,
0.03143310546875,
0.01309967041015625,
0.0202789306640625
],
"index": 0,
"object": "embedding"
},
{
"embedding": [
-0.0230560302734375,
0.039337158203125,
0.0521240234375,
-0.0184783935546875,
0.034271240234375
],
"index": 1,
"object": "embedding"
}
],
"model": "mistral-embed",
"object": "list",
"usage": {
"prompt_tokens": 15,
"completion_tokens": 0,
"total_tokens": 15,
"prompt_audio_seconds": null
}
}