DeepSeek-v4-flash-vision-exp

Aug 21, 2026 05:33 PM - 3 weeks ago 4

The deepseek-v4-flash-vision-exp exemplary accepts images alongside text, truthful you tin inquire the exemplary to picture pictures, publication matter from screenshots, analyse charts, and more.

Supported image formats: JPEG, PNG, GIF, and WebP. The format is detected from the existent record content, not from the record sanction aliases the declared MIME type.


Sending Images​

There are 3 ways to supply an image to the model. All of them usage the modular OpenAI-compatible Chat Completions format, wherever contented is an array of blocks alternatively of a plain string. The aforesaid 3 methods are besides disposable successful the Responses API, wherever images are carried successful input_image contented parts.

The base_url for the examples beneath is https://api.deepseek.com.

1. Base64-encoded image (inline)​

Encode the image and embed it straight successful the petition arsenic a data: URL. This is the simplest action for section files. The encoded information counts toward the 48 MiB petition assemblage limit (see Limits).

import base64
from openai import OpenAI

client = OpenAI(api_key="<DeepSeek API Key>", base_url="https://api.deepseek.com")

with open("image.jpg", "rb") as f:
b64 = base64.b64encode(f.read()).decode("utf-8")

response = client.chat.completions.create(
model="deepseek-v4-flash-vision-exp",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What is successful this image?"},
{
"type": "image_url",
"image_url": {"url": f"data:image/jpeg;base64,{b64}"},
},
],
}
],
)
print(response.choices[0].message.content)
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <DeepSeek API Key>" \
-d '{
"model": "deepseek-v4-flash-vision-exp",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "What is successful this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,<BASE64_DATA>"}}
]
}
]
}'

2. External image URL​

Pass a publically accessible http(s) nexus and the exemplary downloads the image for you. The URL must beryllium astatine astir 8192 characters, the image record whitethorn beryllium astatine astir 32 MiB, and the download must complete wrong 60 seconds. If your nexus is longer, usage a base64 information URL aliases the Files API instead.

response = client.chat.completions.create(
model="deepseek-v4-flash-vision-exp",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image."},
{
"type": "image_url",
"image_url": {"url": "https://example.com/image.jpg"},
},
],
}
],
)
print(response.choices[0].message.content)

3. Reference a record uploaded via the Files API​

Upload an image erstwhile pinch the Files API, past reference its file_id successful your requests. This is the champion action erstwhile you reuse the aforesaid image crossed aggregate requests, aliases erstwhile the image pushes the petition assemblage complete the 48 MiB inline limit. Unlike inline images, images referenced via Files API file_id whitethorn beryllium up to 64 MiB and are not taxable to the 32 MiB per-image check.

Use a record contented artifact pinch the returned file_id (which has the shape file-api-...):

response = client.chat.completions.create(
model="deepseek-v4-flash-vision-exp",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What is successful this image?"},
{"type": "file", "file_id": "file-api-xxxxxxxxxxxxxxxx"},
],
}
],
)
print(response.choices[0].message.content)

Alternatively, a record artifact tin transportation the image inline arsenic base64 via file_data alternatively of file_id (the 2 are mutually exclusive):

{
"type": "file",
"file_data": "data:image/jpeg;base64,<BASE64_DATA>",
"filename": "image.jpg"
}

Detail Level​

For image_url inputs you tin optionally group a item section to power really the image is processed:

ValueBehavior
lowThe image is downscaled to 512×512 earlier inference. Faster and cheaper erstwhile good ocular item is not important.
highKeeps the original image. (Provided for compatibility; balanced to original.)
originalKeeps the original image.
autoAutomatic selection. Currently balanced to original.
{
"type": "image_url",
"image_url": {"url": "https://example.com/image.jpg", "detail": "low"}
}

When to Use the Files API​

Inline images (base64 aliases file_data) count toward the petition assemblage size limit of 48 MiB. Consider the Files API when:

  • A azygous petition would transcend the assemblage size limit.
  • The image is larger than 32 MiB, which is only imaginable done the Files API.
  • You reference the aforesaid image successful aggregate requests and want to debar re-uploading it each time.

Token Usage​

Images are converted into tokens based connected their dimensions, and these tokens are billed together pinch your matter tokens.

Before inference, each image is automatically resized:

  • Images pinch a full pixel count beneath astir 384×384 are scaled up while preserving their facet ratio.
  • Larger images are scaled down while preserving their facet ratio, truthful that the full pixel count aft resizing is astir that of an 800×800 image.

As a result, location is an precocious bound of 384 tokens per image: for example, a 2000×2000 image and a 5000×5000 image devour the aforesaid number of tokens aft resizing. When a petition contains aggregate images, each image is counted independently nether the aforesaid norm — location is nary abstracted calculation for multi-image requests.

To estimate the token costs of an image of a circumstantial size, usage the image token calculator connected the Token & Token Usage page.


Limits​

LimitValue
Supported formatsJPEG, PNG, GIF, WebP
External URL length8192 characters
Request assemblage size48 MiB
Max azygous image size (base64 / outer URL)32 MiB
Max azygous image size (Files API file_id)64 MiB
Max images per request600
Max full image size per request64 MiB without file_id images; up to 200 MiB including file_id images
Max image dimension8192 px per side; drops to 4096 px per broadside erstwhile a petition contains 15 aliases much images

For retention and upload quotas of files uploaded via the Files API, spot Files API: Limits.


Restrictions​

  • Images are supported successful personification messages only: images successful strategy aliases adjunct messages return a 400 error.
  • Only imagination models (deepseek-v4-flash-vision-exp) judge images; different models return a 400 correction ("This exemplary does not support image").
  • User matter containing the reserved image placeholder token is rejected pinch a 400 error.

Using Images pinch the Anthropic API​

In summation to the OpenAI-compatible endpoint above, you tin nonstop images done the Anthropic-compatible /messages endpoint (base_url = https://api.deepseek.com/anthropic). For wide setup, spot Anthropic API.

The quality is the style of the image contented block. Instead of image_url, Anthropic uses an image artifact pinch a root entity whose type is 1 of base64, url, aliases file:

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
model="deepseek-v4-flash-vision-exp",
max_tokens=1024,
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What is successful this image?"},
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "<BASE64_DATA>",
},
},
],
}
],
)
print(message.content)

The 3 root variants reflector the OpenAI methods above:

source.typeEquivalent OpenAI methodNotes
base64Base64-encoded imageRequires a media_type section (image/jpeg, image/png, image/gif, aliases image/webp).
urlExternal image URLMax 8192 characters.
fileFiles API file_idRequires the header anthropic-beta: files-api-2025-04-14.

Using Images pinch the Responses API​

The deepseek-v4-flash-vision-exp exemplary besides accepts images done the OpenAI-compatible Responses API. The aforesaid 3 input methods (base64 information URL, outer http(s) URL, Files API file_id) and the aforesaid limits apply; only the contented portion style differs — images are carried successful input_image parts, either successful personification / developer messages aliases successful the output of function_call_output / custom_tool_call_output items:

response = client.responses.create(
model="deepseek-v4-flash-vision-exp",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "What is successful this image?"},
{"type": "input_image", "image_url": "https://example.com/image.jpg", "detail": "low"},
],
}
],
)
print(response.output_text)

The input_image portion supports a item section pinch the aforesaid semantics arsenic supra (low / precocious / original / auto). item is ignored erstwhile the image is provided via file_id, and image_url and file_id are mutually exclusive.

For section semantics, restrictions (images successful strategy / adjunct messages are rejected pinch a 400 error), and tool-output images, spot the Responses API guide.

More