Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Mistral AI - API - verified

Codestral Embed embeddings

Codestral Embed is a current embedding model from Mistral AI, called by API as codestral-embed. It returns 1,536-dimension vectors by default and accepts up to 8,000 input tokens, for text and code input. The first-party list price is $0.15 per 1M input tokens.

CurrentModel id: codestral-embed

Default dims
1,536
Max input
8,000 tok
Price / 1M
$0.15
Inputs
Text, Code

Dimensions

Flexible output size
  • 3,072
  • 1,536default

Default output: 1,536 dimensions.

Listed sizes: 3,072 and 1,536.

Mistral AI documents shorter output vectors for this model (Matryoshka-style), so you can store smaller embeddings by asking for fewer dimensions instead of re-embedding with another model.

Pricing

Per 1M input tokens
$0.15
Batch, per 1M
Not stated

Input $0.15 per 1M tokens, cached input $0.015; versioned id codestral-embed-2505.

Source: docs.mistral.ai/inference/pricing

Usage

Copied verbatim from the page linked below. Placeholders such as project ids and API keys are the source's own.

Python
import os
from mistralai.client import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "codestral-embed"

client = Mistral(api_key=api_key)

embeddings_batch_response = client.embeddings.create(
    model=model,
    # output_dtype="binary",
    # output_dimension=512,
    inputs=[
        "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1] Constraints: 2 <= nums.length <= 104 -109 <= nums[i] <= 109 -109 <= target <= 109 Only one valid answer exists.",
        "class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: d = {} for i, x in enumerate(nums): if (y := target - x) in d: return [d[y], i] d[x] = i"
      ],
)

Source: docs.mistral.ai/studio/knowledge-rag/embeddings/code_embeddings

Worth knowing

output_dimension defaults to 1536 with a maximum of 3072 (any leading n dimensions can be kept), and output_dtype supports float, int8, uint8, binary and ubinary for code retrieval and code search indexes.

Released . Multilingual: not stated.

FAQ

How many dimensions does Codestral Embed output?

Default output: 1,536 dimensions. Listed sizes: 3,072 and 1,536. Mistral AI documents shorter output vectors for this model (Matryoshka-style), so you can store smaller embeddings by asking for fewer dimensions instead of re-embedding with another model.

What is the max input length of Codestral Embed?

8,000 tokens per input, per Mistral AI's documentation. Longer text has to be chunked before you embed it.

How much does Codestral Embed cost?

The first-party list price is $0.15 per 1M input tokens. Input $0.15 per 1M tokens, cached input $0.015; versioned id codestral-embed-2505. Source: https://docs.mistral.ai/inference/pricing.

What can Codestral Embed embed?

Text and code input, per the provider.

Sources

Last verified from the pages below.

More Mistral AI embedding models

Default dimensions, max input tokens and list price per 1M tokens.

Mistral AI API modelsPrices per 1M tokens, context windows and specs for every Mistral AI model in the API registry.

All embedding models

Newsletter

New models, every week

One email per week. New model releases, embedding and retrieval updates and what they mean for what you build.