DeepSeek V4 Flash Vision API: Images, Tokens & Limits

DeepSeek now has a vision API you can actually ship with. deepseek-v4-flash-vision-exp caps at 384 tokens per image (roughly 1 yuan for 1,000 images), accepts images via base64, external URL, or the Files API, and works across OpenAI, Anthropic, and Responses endpoints. This is the full practical guide: copy-paste code for all three input methods, the detail-level and billing rules, and the complete limits table.

The Model & Supported Formats

deepseek-v4-flash-vision-exp accepts images alongside text. Use it to describe photos, read text from screenshots, or analyze charts.

Supported formats: JPEG, PNG, GIF, WebP. The format is detected from the actual file content, not the file name or declared MIME type.

Three Ways to Send an Image

All three use the standard OpenAI-compatible Chat Completions format, where content is an array of blocks, not a plain string. The base_url is https://api.deepseek.com.

1. Base64 inline. The simplest option for local files. Encode and embed as a data: URL; it counts toward the 48 MiB request body limit:

import base64
from openai import OpenAI

client = OpenAI(api_key="<KEY>", base_url="https://api.deepseek.com")
b64 = base64.b64encode(open("image.jpg", "rb").read()).decode()
resp = client.chat.completions.create(
    model="deepseek-v4-flash-vision-exp",
    messages=[{"role": "user", "content": [
        {"type": "text", "text": "What is in this image?"},
        {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
    ]}],
)
print(resp.choices[0].message.content)

2. External image URL. Pass a publicly accessible http(s) link; the model downloads it. The URL can be up to 8192 characters, the image up to 32 MiB, and the download must finish within 60 seconds. For longer links, use base64 or the Files API.

3. Files API file_id. Upload once, then reference the file_id. Best for reusing one image across requests, or when the request would exceed the 48 MiB inline limit. A file block can also carry the image inline via file_data (mutually exclusive with file_id).

Detail Levels & Token Cost

The optional detail field on image_url inputs controls processing: low downscales to 512×512 (faster and cheaper); high and original keep the original; auto currently equals original.

Images are billed as tokens based on dimensions and are auto-resized before inference to roughly an 800×800 footprint. That gives a hard 384-token cap per image — a 2000×2000 and a 5000×5000 image cost the same. With multiple images, each is counted independently under the same rule.

Full Limits Table

LimitValue
Supported formatsJPEG, PNG, GIF, WebP
External URL length8192 characters
Request body size48 MiB
Max image (base64 / URL)32 MiB
Max image (Files API)64 MiB
Max images per request600
Max image dimension8192 px per side; 4096 px with 15+ images

Anthropic & Responses API Compatibility

You can also send images through the Anthropic-compatible /messages endpoint (base_url https://api.deepseek.com/anthropic). The difference is the content block shape: Anthropic uses an image block whose source.type is base64, url, or file — base64 requires a media_type field.

The Responses API supports the same three input methods, with images carried in input_image parts inside user or developer messages, or in tool-output items; the detail field works the same way.

Restrictions & Common 400 Errors

  • Images are allowed in user messages only: images in system or assistant messages return a 400 error.
  • Only vision models (deepseek-v4-flash-vision-exp) accept images; other models return a 400 error ("This model does not support image").
  • User text containing the reserved image placeholder token is rejected with a 400 error.

FAQ

Q: How much does one vision call cost?
Each image is capped at 384 tokens and billed with your text tokens — roughly 1 yuan for 1,000 images, about 25x cheaper than Claude Sonnet 4.6 (see our DeepSeek V4 Flash Vision launch coverage).

Q: What if my image is larger than 32 MiB?
Use the Files API: images referenced by file_id can be up to 64 MiB and skip the 32 MiB per-image check.

Q: How many images can I send in one request?
Up to 600. With 15 or more images, the per-side dimension cap drops from 8192 px to 4096 px. To cut cost on large images, add detail=low.

Related Reading

DeepSeek V4 Pro API: What Changed and How to Use It · DeepSeek V4 Flash Vision launch coverage

Leave a Comment

Scroll to top