logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·05.11.26
← Back to news

DeepSeek-v4-flash-vision-exp

Original article
api-docs.deepseek.com|379 points|124 comments|by dares2573|Aug 21, 2026

DeepSeek-v4-flash-vision-exp

The deepseek-v4-flash-vision-exp model is a multimodal powerhouse capable of processing both textual and visual data. This allows users to perform tasks such as image captioning, OCR (optical character recognition) from screenshots, and complex chart analysis.

Note: The system determines the image format by analyzing the actual file content; it does not rely on the file extension or the MIME type.

🖼️ Methods for Sending Images

You can provide visual input using three distinct methods. All three follow the OpenAI-compatible Chat Completions standard, utilizing an array of content blocks rather than a simple string. These methods are also compatible with the Responses API via input_image parts.

API Base URL: https://api.deepseek.com

1. Base64-Encoded Images (Inline)

You can embed an image directly into your JSON request by encoding it as a data: URL.

  • Constraint: The encoded string contributes to the total request body limit of 48 MiB.

Python Example:

import base64 
from openai import OpenAI 

client = OpenAI(api_key="YOUR_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 in this image?"},
                {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
            ],
        }
    ],
)
print(response.choices[0].message.content)

cURL Example:

curl https://api.deepseek.com/chat/completions \
-H Content-Type: application/json \
-H Authorization: Bearer YOUR_DEEPSEEK_API_KEY \
-d '{
  "model": "deepseek-v4-flash-vision-exp",
  "messages": [
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What is in this image?"},
        {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,BASE64_DATA"}}
      ]
    }
  ]
}'

2. External Image URLs

Provide a publicly accessible link, and the model will fetch the image automatically.

  • URL Length: Max 8,192 characters.
  • File Size: Max 32 MiB.
  • Timeout: Download must finish within 60 seconds.
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"}},
            ],
        }
    ],
)

3. Files API Reference

Upload an image once via the Files API and reference its file_id (e.g., file-api-xxxxxxxxxxxxxxxx). This is the most efficient method for repeated use of the same asset or for very large files.

  • Advantage: Images can be up to 64 MiB and bypass the 32 MiB check applied to URLs/Base64.
client.chat.completions.create(
    model="deepseek-v4-flash-vision-exp",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What is in this image?"},
                {"type": "file", "file_id": "file-api-xxxxxxxxxxxxxxxx"},
            ],
        }
    ],
)

Alternatively, you can use a file block with file_data (base64) and a filename instead of a file_id.


🛠️ Configuration & Optimization

Detail Level

For image_url inputs, you can specify the detail parameter:

ValueBehavior
lowImage is downscaled to 512×512512 \times 512512×512 pixels before processing.
originalThe image is processed in its original resolution.

Example: {"type": "image_url", "image_url": {"url": "...", "detail": "low"}}

When to utilize the Files API?

  • Your request body exceeds the 48 MiB limit.
  • Your image file is larger than 32 MiB.
  • You are using the same image across multiple different requests.

🪙 Token Usage & Billing

Images are converted into tokens based on their dimensions. These are billed alongside your text tokens.

The Resizing Logic:

  1. Upscaling: Images smaller than roughly 384×384384 \times 384384×384 pixels are scaled up (maintaining aspect ratio).
  2. Downscaling: Larger images are scaled down (maintaining aspect ratio) to a total pixel count roughly equivalent to an 800×800800 \times 800800×800 image.

Key Token Facts:

  • Upper Bound: There is a maximum of 384 tokens per image.
  • Consistency: A 2000×20002000 \times 20002000×2000 image and a 5000×50005000 \times 50005000×5000 image will cost the same amount of tokens.
  • Multi-Image: Each image is calculated independently; there is no bulk discount or different formula for multiple images.

📏 System Limits

LimitValue
Supported FormatsJPEG, PNG, GIF, WebP
External URL Max Length8,192 characters
Request Body Max Size48 MiB
Max Image Size (Base64/URL)32 MiB
Max Image Size (Files API)64 MiB
Max Images per Request600
Total Image Size (no file_id)64 MiB
Total Image Size (with file_id)200 MiB
Max Image Dimension8,192 px per side (drops to 4,096 px if ≥15\ge 15≥15 images)

⚠️ Restrictions

  • Message Role: Images are only permitted in user messages. Including them in system or assistant messages will trigger a 400 error.
  • Model Compatibility: Only deepseek-v4-flash-vision-exp supports images. Other models will return a 400 error stating "This model does not support image".
  • Reserved Tokens: Any user text containing the internal reserved image placeholder token will be rejected with a 400 error.

🔌 Anthropic API Compatibility

Beyond the OpenAI-style endpoint, you can also transmit images using the Anthropic-compatible /messages endpoint by setting your base_url to https://api.deepseek.com/anthrop.

API Integration Concept