Vision | DeepSeek API Docs (../../img/favicon.svg) (https://api-docs.deepseek.com/guides/vision) (https://api-docs.deepseek.com/guides/vision) (https://api-docs.deepseek.com/zh-cn/guides/vision) (https://api-docs.deepseek.com/guides/vision) (../../assets/css/styles.59daef4c.css) (index.html#__docusaurus_skipToContent_fallback) Skip to main content (https://api-docs.deepseek.com/) (DeepSeek API Docs Logo) (DeepSeek API Docs Logo) DeepSeek API Docs (index.html#) English (https://api-docs.deepseek.com/guides/vision) English (https://api-docs.deepseek.com/zh-cn/guides/vision) 中文(中国) (https://platform.deepseek.com/) DeepSeek Platform (Switch between dark and light mode (currently light mode)) (https://api-docs.deepseek.com/) Quick Start (https://api-docs.deepseek.com/) Your First API Call (https://api-docs.deepseek.com/quick_start/pricing) Models & Pricing (https://api-docs.deepseek.com/quick_start/token_usage) Token & Token Usage (https://api-docs.deepseek.com/quick_start/rate_limit) Rate Limit & Isolation (https://api-docs.deepseek.com/quick_start/error_codes) Error Codes (https://deepseek-harness.github.io/deepseek-harness/en/guide/quickstart) Agent Integrations (https://api-docs.deepseek.com/guides/vision) API Guides (https://api-docs.deepseek.com/guides/vision) Vision (https://api-docs.deepseek.com/guides/thinking_mode) Thinking Mode (https://api-docs.deepseek.com/guides/multi_round_chat) Multi-round Conversation (https://api-docs.deepseek.com/guides/chat_prefix_completion) Chat Prefix Completion (Beta) (https://api-docs.deepseek.com/guides/fim_completion) FIM Completion (Beta) (https://api-docs.deepseek.com/guides/json_mode) JSON Output (https://api-docs.deepseek.com/guides/tool_calls) Tool Calls (https://api-docs.deepseek.com/guides/files_api) Files API (https://api-docs.deepseek.com/guides/kv_cache) Context Caching (https://api-docs.deepseek.com/guides/responses_api) Using the Responses API (https://api-docs.deepseek.com/guides/anthropic_api) Using the Anthropic API (https://api-docs.deepseek.com/api/create-chat-completion) API Reference (https://api-docs.deepseek.com/news/news260821) News (https://github.com/deepseek-ai/awesome-deepseek-integration/tree/main) Other Resources (https://static.deepseek.com/faq/index.html?lang=en#/category/4) FAQ (https://api-docs.deepseek.com/updates) Change Log (https://api-docs.deepseek.com/) API Guides Vision On this page Vision The deepseek-v4-flash-vision-exp model accepts images alongside text, so you can ask the model to describe pictures, read text from screenshots, analyze charts, and more. Supported 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. Sending Images(index.html#sending-images) (Direct link to Sending Images) ​ There are three ways to provide an image to the model. All of them use the standard OpenAI-compatible Chat Completions format, where content is an array of blocks instead of a plain string. The same three methods are also available in the (https://api-docs.deepseek.com/guides/responses_api#image-input) Responses API , where images are carried in input_image content parts. The base_url for the examples below is https://api.deepseek.com . 1. Base64-encoded image (inline)(index.html#1-base64-encoded-image-inline) (Direct link to 1. Base64-encoded image (inline)) ​ Encode the image and embed it directly in the request as a data: URL. This is the simplest option for local files. The encoded data counts toward the 48 MiB request body limit (see (index.html#limits) Limits ). import base64 from openai import OpenAI client = OpenAI ( 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 ) (Copy) curl https://api.deepseek.com/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -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,"}} ] } ] }' (Copy) 2. External image URL(index.html#2-external-image-url) (Direct link to 2. External image URL) ​ Pass a publicly accessible http(s) link 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. 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 ) (Copy) 3. Reference a file uploaded via the Files API(index.html#3-reference-a-file-uploaded-via-the-files-api) (Direct link to 3. Reference a file uploaded via the Files API) ​ Upload an image once with the (https://api-docs.deepseek.com/guides/files_api) Files API , then reference its file_id in 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 may be up to 64 MiB and are not subject to the 32 MiB per-image check. Use a file content block with the returned file_id (which has the form file-api-... ): response = 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 ) (Copy) Alternatively, a file block can carry the image inline as base64 via file_data instead of file_id (the two are mutually exclusive): { "type": "file", "file_data": "data:image/jpeg;base64,", "filename": "image.jpg" } (Copy) Detail Level(index.html#detail-level) (Direct link to Detail Level) ​ For image_url inputs you can optionally set a detail field to control how the image is processed: Value Behavior low The image is downscaled to 512×512 before inference. Faster and cheaper when fine visual detail is not important. high Keeps the original image. (Provided for compatibility; equivalent to original .) original Keeps the original image. auto Automatic selection. Currently equivalent to original . { "type": "image_url", "image_url": {"url": "https://example.com/image.jpg", "detail": "low"} } (Copy) When to Use the Files API(index.html#when-to-use-the-files-api) (Direct link to When to Use the Files API) ​ Inline images (base64 or file_data ) count toward the request body size limit of 48 MiB . Consider the (https://api-docs.deepseek.com/guides/files_api) Files API when: A single request would exceed the body size limit. The image is larger than 32 MiB, which is only possible through the Files API. You reference the same image in multiple requests and want to avoid re-uploading it each time. Token Usage(index.html#token-usage) (Direct link to Token Usage) ​ Images are converted into tokens based on their dimensions, and these tokens are billed together with your text tokens. Before inference, every image is automatically resized: Images with a total pixel count below roughly 384×384 are scaled up while preserving their aspect ratio. Larger images are scaled down while preserving their aspect ratio, so that the total pixel count after resizing is roughly that of an 800×800 image. As 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. To estimate the token cost of an image of a specific size, use the image token calculator on the (https://api-docs.deepseek.com/quick_start/token_usage) Token & Token Usage page. Limits(index.html#limits) (Direct link to Limits) ​ Limit Value Supported formats JPEG, PNG, GIF, WebP External URL length 8192 characters Request body size 48 MiB Max single image size (base64 / external URL) 32 MiB Max single image size (Files API file_id ) 64 MiB Max images per request 600 Max total image size per request 64 MiB without file_id images; up to 200 MiB including file_id images Max image dimension 8192 px per side; drops to 4096 px per side when a request contains 15 or more images For storage and upload quotas of files uploaded via the Files API, see (https://api-docs.deepseek.com/guides/files_api#limits) Files API: Limits . Restrictions(index.html#restrictions) (Direct link to Restrictions) ​ Images are supported 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. Using Images with the Anthropic API(index.html#using-images-with-the-anthropic-api) (Direct link to Using Images with the Anthropic API) ​ In addition to the OpenAI-compatible endpoint above, you can send images through the Anthropic-compatible /messages endpoint (base_url = https://api.deepseek.com/anthropic ). For general setup, see (https://api-docs.deepseek.com/guides/anthropic_api) Anthropic API . The difference is the shape of the image content block. Instead of image_url , Anthropic uses an image block with a source object whose type is one of base64 , url , or file : import anthropic client = anthropic . Anthropic ( ) # ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic message = 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" : "" , } , } , ] , } ] , ) print ( message . content ) (Copy) The three source variants mirror the OpenAI methods above: source.type Equivalent OpenAI method Notes base64 Base64-encoded image Requires a media_type field (image/jpeg , image/png , image/gif , or image/webp ). url External image URL Max 8192 characters. file Files API file_id Requires the header anthropic-beta: files-api-2025-04-14 . Using Images with the Responses API(index.html#responses-api) (Direct link to Using Images with the Responses API) ​ The deepseek-v4-flash-vision-exp model also accepts images through the OpenAI-compatible (https://api-docs.deepseek.com/guides/responses_api#image-input) Responses API . The same three input methods (base64 data URL, external http(s) URL, Files API file_id ) and the same (index.html#limits) limits apply; only the content part shape differs — images are carried in input_image parts, either in user / developer messages or in 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 in this image?" } , { "type" : "input_image" , "image_url" : "https://example.com/image.jpg" , "detail" : "low" } , ] , } ] , ) print ( response . output_text ) (Copy) The input_image part supports a detail field with the same semantics as above (low / high / original / auto ). detail is ignored when the image is provided via file_id , and image_url and file_id are mutually exclusive. For field semantics, restrictions (images in system / assistant messages are rejected with a 400 error), and tool-output images, see the (https://api-docs.deepseek.com/guides/responses_api#image-input) Responses API guide . (https://api-docs.deepseek.com/quick_start/agent_integrations/workbuddy) Previous WorkBuddy/CodeBuddy (https://api-docs.deepseek.com/guides/thinking_mode) Next Thinking Mode (index.html#sending-images) Sending Images (index.html#1-base64-encoded-image-inline) 1. Base64-encoded image (inline) (index.html#2-external-image-url) 2. External image URL (index.html#3-reference-a-file-uploaded-via-the-files-api) 3. Reference a file uploaded via the Files API (index.html#detail-level) Detail Level (index.html#when-to-use-the-files-api) When to Use the Files API (index.html#token-usage) Token Usage (index.html#limits) Limits (index.html#restrictions) Restrictions (index.html#using-images-with-the-anthropic-api) Using Images with the Anthropic API (index.html#responses-api) Using Images with the Responses API WeChat Official Account (WeChat QRcode) Community (mailto:api-service@deepseek.com) Email (https://discord.gg/Tc7c45Zzu5) Discord (https://twitter.com/deepseek_ai) Twitter More (https://github.com/deepseek-ai) GitHub Copyright © 2026 DeepSeek, Inc.