mistralM

Docs

Vision

Send images to vision-capable models through the Chat Completions API and analyze visual content alongside text.

Vision capabilities enable models to analyze images and provide insights based on visual content in addition to text. This multimodal approach opens up new possibilities for applications that require both textual and visual understanding.

We provide a variety of models with vision capabilities, all available via the Chat Completions API.

lightbulb

For document parsing, OCR, and data extraction, see Document AI.

Before You Start

  • Mistral Large 4 via mistral-large-4-0
  • Mistral Large 3 via mistral-large-2512
  • Mistral Medium 3.1 via mistral-medium-2508
  • Mistral Small 3.2 via mistral-small-2506
  • Ministral 3:
    • Ministral 3 14B via ministral-14b-2512
    • Ministral 3 8B via ministral-8b-2512
    • Ministral 3 3B via ministral-3b-2512

Sending an Image

Use Vision Models

There are two ways to send an image to the Chat Completions API, either by passing a URL or by passing a base64 encoded image.

lightbulb

Before continuing, we recommend reading the Chat Completions documentation to learn more about the chat completions API and how to use it before proceeding.

If the image is hosted online, you can simply provide the publicaly accessible URL of the image in the request. This method is straightforward and does not require any encoding.

import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "mistral-small-latest"

client = Mistral(api_key=api_key)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "What's in this image?"
            },
            {
                "type": "image_url",
                "image_url": "/images/eiffel-tower-paris.jpg"
            }
        ]
    }
]

chat_response = client.chat.complete(
    model=model,
    messages=messages
)
Output
{
    "id": "a8251fb1c4a64014b80141bd5685f6c7",
    "created": 1756318369,
    "model": "mistral-small-latest",
    "usage": {
    "prompt_tokens": 2099,
    "total_tokens": 2235,
    "completion_tokens": 136
    },
    "object": "chat.completion",
    "choices": [
    {
        "index": 0,
        "finish_reason": "stop",
        "message": {
        "role": "assistant",
        "tool_calls": null,
        "content": "The image depicts the Eiffel Tower, an iconic landmark located in Paris, France. The photograph is taken from a low angle, looking up towards the sky, emphasizing the tower's impressive height and intricate iron lattice structure. The Eiffel Tower is composed of three main levels, each offering viewing platforms for visitors. The sky is clear and blue, providing a striking contrast to the brownish hue of the iron tower. The base of the tower is framed by trees, adding a touch of natural greenery to the scene. In the background, beyond the tower, some buildings are visible, indicating the urban setting of the Eiffel Tower in the heart of Paris."
        }
    }
    ]
}

Use cases

Below you can find a few examples of use cases leveraging our models vision, from understanding graphs to extract data, the use cases are diverse.

pen

These are simple examples you can use as inspiration to build your own use cases. For OCR and structured outputs, see Document AI.

curl https://api.mistral.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MISTRAL_API_KEY" \
  -d '{
    "model": "ministral-14b-latest",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What’s in this image?"
          },
          {
            "type": "image_url",
            "image_url": "https://cdn.statcdn.com/Infographic/images/normal/30322.jpeg"
          }
        ]
      }
    ],
    "max_tokens": 300
  }'
Output
The chart is a bar chart titled 'France's Social Divide,' comparing socio-economic indicators between disadvantaged areas and the whole of France. It comprises two sections: the first section includes three bar groups representing the percentage of people part of the working-class, unemployment rate, and percentage of 16-25-year-olds not in school and unemployed. The second section includes three bar groups representing median monthly income, poverty rate, and households living in overcrowded housing. Each bar group contains two bars: one for disadvantaged areas (red) and one for the whole of France (blue). The data indicate that disadvantaged areas have higher percentages of working-class individuals (33.5% vs. 14.5%), unemployment (18.1% vs. 7.3%), and young people not in school and unemployed (25.2% vs. 12.9%). They also show a lower median monthly income (€1,168 vs. €1,822), a higher poverty rate (43.3% vs. 15.5%), and a higher percentage of households living in overcrowded housing (22.0% vs. 8.7%). The chart highlights significant disparities in socio-economic conditions between disadvantaged areas and the rest of France, emphasizing the challenges faced by these communities.

FAQ

The price is calculated using the same pricing as input tokens per image, with each image being tokenized.

Depending on the model and resolution, an image will be tokenized differently. Below is a summary.

Model

Max Resolution

≈ Formula

≈ N Max Tokens

Mistral Large 31540x1540≈ (ResolutionX * ResolutionY) / 784≈ 3025
Mistral Small 3.21540x1540≈ (ResolutionX * ResolutionY) / 784≈ 3025
Mistral Medium 31540x1540≈ (ResolutionX * ResolutionY) / 784≈ 3025
Ministral 31540x1540≈ (ResolutionX * ResolutionY) / 784≈ 3025
Pixtral Large1024x1024≈ (ResolutionX * ResolutionY) / 256≈ 4096
Pixtral 12B1024x1024≈ (ResolutionX * ResolutionY) / 256≈ 4096

If the resolution of the image sent is higher than the maximum resolution of the model, the image will be downscaled to its maximum resolution. An error will be sent if the resolution is higher than 10000x10000.

No, they are designed to understand and analyze images, not to generate them.

We currently support the following image formats:

  • PNG (.png)
  • JPEG (.jpeg and .jpg)
  • WEBP (.webp)
  • Non-animated GIF with only one frame (.gif)

The current file size limit is 10Mb.

The maximum number images per request via API is 8.

For information on rate limits, visit Studio › LimitsarrowUpRight.