{"slug": "deepseek-v4-flash-vision-exp", "title": "DeepSeek-v4-flash-vision-exp", "summary": "DeepSeek released deepseek-v4-flash-vision-exp, a vision-language model that accepts images alongside text via the OpenAI-compatible Chat Completions API, supporting JPEG, PNG, GIF, and WebP formats. The model can be accessed through three input methods: base64-encoded inline images (up to 48 MiB request body limit), external image URLs (max 8192 characters, 32 MiB file, 60-second download), or Files API file_id references (up to 64 MiB).", "body_md": "# Vision\n\nThe `deepseek-v4-flash-vision-exp`\n\nmodel accepts images alongside text, so you can ask the model to describe pictures, read text from screenshots, analyze charts, and more.\n\nSupported image formats: **JPEG, PNG, GIF, and WebP**. The format is detected from the actual file content, not from the file name or the declared MIME type.\n\n## Sending Images\n\nThere are three ways to provide an image to the model. All of them use the standard OpenAI-compatible Chat Completions format, where `content`\n\nis an array of blocks instead of a plain string. The same three methods are also available in the [Responses API](/guides/responses_api#image-input), where images are carried in `input_image`\n\ncontent parts.\n\nThe `base_url`\n\nfor the examples below is `https://api.deepseek.com`\n\n.\n\n### 1. Base64-encoded image (inline)\n\nEncode the image and embed it directly in the request as a `data:`\n\nURL. This is the simplest option for local files. The encoded data counts toward the **48 MiB** request body limit (see [Limits](#limits)).\n\n``` python\nimport base64from openai import OpenAIclient = 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 in this image?\"},                {                    \"type\": \"image_url\",                    \"image_url\": {\"url\": f\"data:image/jpeg;base64,{b64}\"},                },            ],        }    ],)print(response.choices[0].message.content)\ncurl 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 in this image?\"},          {\"type\": \"image_url\", \"image_url\": {\"url\": \"data:image/jpeg;base64,<BASE64_DATA>\"}}        ]      }    ]  }'\n```\n\n### 2. External image URL\n\nPass a publicly accessible `http(s)`\n\nlink and the model downloads the image for you. The URL must be at most **8192 characters**, the image file may be at most **32 MiB**, and the download must complete within **60 seconds**. If your link is longer, use a base64 data URL or the Files API instead.\n\n```\nresponse = 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)\n```\n\n### 3. Reference a file uploaded via the Files API\n\nUpload an image once with the [Files API](/guides/files_api), then reference its `file_id`\n\nin your requests. This is the best option when you reuse the same image across multiple requests, or when the image pushes the request body over the 48 MiB inline limit. Unlike inline images, images referenced via Files API `file_id`\n\nmay be up to 64 MiB and are not subject to the 32 MiB per-image check.\n\nUse a `file`\n\ncontent block with the returned `file_id`\n\n(which has the form `file-api-...`\n\n):\n\n```\nresponse = 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\"},            ],        }    ],)print(response.choices[0].message.content)\n```\n\nAlternatively, a `file`\n\nblock can carry the image inline as base64 via `file_data`\n\ninstead of `file_id`\n\n(the two are mutually exclusive):\n\n```\n{  \"type\": \"file\",  \"file_data\": \"data:image/jpeg;base64,<BASE64_DATA>\",  \"filename\": \"image.jpg\"}\n```\n\n## Detail Level\n\nFor `image_url`\n\ninputs you can optionally set a `detail`\n\nfield to control how the image is processed:\n\n| Value | Behavior |\n|---|---|\n`low` | The image is downscaled to 512×512 before inference. Faster and cheaper when fine visual detail is not important. |\n`high` | Keeps the original image. (Provided for compatibility; equivalent to `original` .) |\n`original` | Keeps the original image. |\n`auto` | Automatic selection. Currently equivalent to `original` . |\n\n```\n{  \"type\": \"image_url\",  \"image_url\": {\"url\": \"https://example.com/image.jpg\", \"detail\": \"low\"}}\n```\n\n## When to Use the Files API\n\nInline images (base64 or `file_data`\n\n) count toward the request body size limit of **48 MiB**. Consider the [Files API](/guides/files_api) when:\n\n- A single request would exceed the body size limit.\n- The image is larger than 32 MiB, which is only possible through the Files API.\n- You reference the same image in multiple requests and want to avoid re-uploading it each time.\n\n## Token Usage\n\nImages are converted into tokens based on their dimensions, and these tokens are billed together with your text tokens.\n\nBefore inference, every image is automatically resized:\n\n- Images with a total pixel count below roughly 384×384 are scaled up while preserving their aspect ratio.\n- Larger images are scaled down while preserving their aspect ratio, so that the total pixel count after resizing is roughly that of an\n**800×800** image.\n\nAs a result, there is an upper bound of **384** tokens per image: for example, a 2000×2000 image and a 5000×5000 image consume the same number of tokens after resizing. When a request contains multiple images, each image is counted independently under the same rule — there is no separate calculation for multi-image requests.\n\nTo estimate the token cost of an image of a specific size, use the image token calculator on the [Token & Token Usage](/quick_start/token_usage) page.\n\n## Limits\n\n| Limit | Value |\n|---|---|\n| Supported formats | JPEG, PNG, GIF, WebP |\n| External URL length | 8192 characters |\n| Request body size | 48 MiB |\n| Max single image size (base64 / external URL) | 32 MiB |\nMax single image size (Files API `file_id` ) | 64 MiB |\n| Max images per request | 600 |\n| Max total image size per request | 64 MiB without `file_id` images; up to 200 MiB including `file_id` images |\n| Max image dimension | 8192 px per side; drops to 4096 px per side when a request contains 15 or more images |\n\nFor storage and upload quotas of files uploaded via the Files API, see [Files API: Limits](/guides/files_api#limits).\n\n## Restrictions\n\n- Images are supported in\n`user`\n\nmessages only: images in`system`\n\nor`assistant`\n\nmessages return a`400`\n\nerror. - Only vision models (\n`deepseek-v4-flash-vision-exp`\n\n) accept images; other models return a`400`\n\nerror (\"This model does not support image\"). - User text containing the reserved image placeholder token is rejected with a\n`400`\n\nerror.\n\n## Using Images with the Anthropic API\n\nIn addition to the OpenAI-compatible endpoint above, you can send images through the Anthropic-compatible `/messages`\n\nendpoint (`base_url`\n\n= `https://api.deepseek.com/anthropic`\n\n). For general setup, see [Anthropic API](/guides/anthropic_api).\n\nThe difference is the shape of the image content block. Instead of `image_url`\n\n, Anthropic uses an `image`\n\nblock with a `source`\n\nobject whose `type`\n\nis one of `base64`\n\n, `url`\n\n, or `file`\n\n:\n\n``` python\nimport anthropicclient = anthropic.Anthropic()  # ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropicmessage = client.messages.create(    model=\"deepseek-v4-flash-vision-exp\",    max_tokens=1024,    messages=[        {            \"role\": \"user\",            \"content\": [                {\"type\": \"text\", \"text\": \"What is in this image?\"},                {                    \"type\": \"image\",                    \"source\": {                        \"type\": \"base64\",                        \"media_type\": \"image/jpeg\",                        \"data\": \"<BASE64_DATA>\",                    },                },            ],        }    ],)print(message.content)\n```\n\nThe three `source`\n\nvariants mirror the OpenAI methods above:\n\n`source.type` | Equivalent OpenAI method | Notes |\n|---|---|---|\n`base64` | Base64-encoded image | Requires a `media_type` field (`image/jpeg` , `image/png` , `image/gif` , or `image/webp` ). |\n`url` | External image URL | Max 8192 characters. |\n`file` | Files API `file_id` | Requires the header `anthropic-beta: files-api-2025-04-14` . |\n\n## Using Images with the Responses API\n\nThe `deepseek-v4-flash-vision-exp`\n\nmodel also accepts images through the OpenAI-compatible [Responses API](/guides/responses_api#image-input). The same three input methods (base64 data URL, external `http(s)`\n\nURL, Files API `file_id`\n\n) and the same [limits](#limits) apply; only the content part shape differs — images are carried in `input_image`\n\nparts, either in `user`\n\n/ `developer`\n\nmessages or in the output of `function_call_output`\n\n/ `custom_tool_call_output`\n\nitems:\n\n```\nresponse = client.responses.create(    model=\"deepseek-v4-flash-vision-exp\",    input=[        {            \"role\": \"user\",            \"content\": [                {\"type\": \"input_text\", \"text\": \"What is in this image?\"},                {\"type\": \"input_image\", \"image_url\": \"https://example.com/image.jpg\", \"detail\": \"low\"},            ],        }    ],)print(response.output_text)\n```\n\nThe `input_image`\n\npart supports a `detail`\n\nfield with the same semantics as above (`low`\n\n/ `high`\n\n/ `original`\n\n/ `auto`\n\n). `detail`\n\nis ignored when the image is provided via `file_id`\n\n, and `image_url`\n\nand `file_id`\n\nare mutually exclusive.\n\nFor field semantics, restrictions (images in `system`\n\n/ `assistant`\n\nmessages are rejected with a `400`\n\nerror), and tool-output images, see the [Responses API guide](/guides/responses_api#image-input).", "url": "https://wpnews.pro/news/deepseek-v4-flash-vision-exp", "canonical_source": "https://api-docs.deepseek.com/guides/vision/", "published_at": "2026-08-21 10:33:56+00:00", "updated_at": "2026-08-21 18:42:45.598376+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "computer-vision", "generative-ai", "ai-products"], "entities": ["DeepSeek", "deepseek-v4-flash-vision-exp", "OpenAI", "Files API"], "alternates": {"html": "https://wpnews.pro/news/deepseek-v4-flash-vision-exp", "markdown": "https://wpnews.pro/news/deepseek-v4-flash-vision-exp.md", "text": "https://wpnews.pro/news/deepseek-v4-flash-vision-exp.txt", "jsonld": "https://wpnews.pro/news/deepseek-v4-flash-vision-exp.jsonld"}}