Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Embeddings Endpoints

Embeddings API.

Embeddings

POST /v1/embeddings

Embeddings

200

Successful Response

id
*string
model
*string
object
*string
usage
*UsageInfo

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();
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"
}'

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
  }
}