Seek-Chat
Open chat

Does the DeepSeek API Support Images and Vision Input?

The DeepSeek API now accepts image input through the experimental deepseek-v4-flash-vision-exp model. It can analyze screenshots, charts, photographs, scanned pages, and other supported images supplied by public URL, Base64 data URL, or a DeepSeek Files API file_id. The standard deepseek-v4-flash and deepseek-v4-pro models remain text-only.

10 min read Checked against primary sources

Last verified: September 3, 2026. Scope: DeepSeek’s public hosted API, including Chat Completions, Responses, the Anthropic-compatible Messages route, Vision guide, and Files API. The request patterns below are documentation-based; no paid inference request was made for this update.

Quick answer: does the DeepSeek API support images?

Yes—use deepseek-v4-flash-vision-exp. DeepSeek released this experimental vision-understanding model on August 21, 2026. It supports mixed text-and-image input in Chat Completions, Responses, and the Anthropic-compatible Messages API.

This is an image-understanding API, not an image-generation endpoint. It returns text about an image; it does not create image pixels. PDF and general document files are also not accepted by the new Files API: the documented upload formats are JPEG, PNG, GIF, and WebP images.

Use the exact hosted Vision model ID

For image input on DeepSeek’s hosted API, set model to deepseek-v4-flash-vision-exp. It is the currently documented experimental image-understanding model. The standard deepseek-v4-flash and deepseek-v4-pro models are text-only, so changing the SDK or content block does not add vision to them.

Do not confuse the hosted API model ID with the separate open-weight repository, deepseek-ai/DeepSeek-V4-Flash-Vision-Exp. The repository is for self-hosting under its published license; its endpoints, limits, and hardware depend on the serving stack. This guide covers the hosted API contract. See the Vision Exp model profile for release status and model-level details, and the DeepSeek API overview for authentication and general setup.

In Chat Completions, images belong in a user message. Images in system or assistant messages return HTTP 400. Use one of the documented URL, Base64, or file_id patterns below.

Choose an image input method: URL, Base64, or file_id

MethodUse it whenMain trade-off
Public HTTP(S) URLThe image is already hosted at a stable public URLDeepSeek must be able to download it within the documented time and size limits
Base64 data URLA local or private image is used onceEncoded bytes enlarge the request and count toward the 48 MiB request-body limit
Files API file_idThe image is large or reused across requestsRequires upload, retention, access-control, and deletion lifecycle management

Supported formats are JPEG, PNG, GIF, and WebP. DeepSeek says it detects the format from the actual file content, not merely the filename extension or declared MIME type. Validate the bytes before upload instead of trusting a user-supplied extension.

Chat Completions: send a public image URL

The OpenAI-compatible Chat Completions request uses a user content array containing a text part and an image_url part. Keep the DeepSeek key on the server. For SDK setup and error handling beyond vision, see the DeepSeek Python SDK guide.

curl https://api.deepseek.com/chat/completions \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash-vision-exp",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Describe this chart and state any uncertainty."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/chart.png",
              "detail": "original"
            }
          }
        ]
      }
    ],
    "stream": false
  }'

A public URL must use HTTP or HTTPS, be no longer than 8,192 characters, point to an image no larger than 32 MiB, and complete its download within 60 seconds. Expired signed URLs, login-protected assets, blocked hotlinks, and internal-only hostnames can fail.

Python: send a local image as Base64

import base64
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com",
)

with open("chart.png", "rb") as image_file:
    encoded = base64.b64encode(image_file.read()).decode("ascii")

data_url = "data:image/png;base64," + encoded

response = client.chat.completions.create(
    model="deepseek-v4-flash-vision-exp",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Extract the title, axes, legend, values, and trends.",
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": data_url,
                        "detail": "original",
                    },
                },
            ],
        }
    ],
)

print(response.choices[0].message.content)

Set the data-URL media type to match the validated image bytes. Inline image data counts toward the request-body limit, so use Files API for a large image or repeated analysis.

Upload once and reuse an image with DeepSeek Files API

Files API stores supported images and returns a file_id such as file-api-.... A Chat Completions message references it with a file content block.

Temporary-file handling is the same for Vision uploads as for any other Files API upload, so it is documented once: see expiry and best-effort cleanup in the Files API guide, which carries the worked Python example.

The two alternatives inside a Chat Completions file block are mutually exclusive: use a stored file_id, or send inline file_data with a filename. Do not include both.

Use purpose="user_data". A stored image may be up to 64 MiB, and omitting expires_after can leave it stored permanently, so set an expiry or delete it when the workflow ends. For upload limits, storage quotas, expiry, and deletion, use the dedicated DeepSeek Files API guide.

This is not a general document-ingestion API. PDF, DOCX, spreadsheets, archives, and arbitrary files are not supported by the documented DeepSeek Files API. Convert a PDF page to a supported image when visual page analysis is appropriate, or extract the document text in your own pipeline before using a text model. See the separate DeepSeek Files API guide for lifecycle details.

Use image input with the Responses API

Responses uses input_text and input_image parts rather than the Chat Completions text and image_url shape.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com",
)

response = client.responses.create(
    model="deepseek-v4-flash-vision-exp",
    input=[
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Summarize this interface."},
                {
                    "type": "input_image",
                    "image_url": "https://example.com/screenshot.webp",
                    "detail": "low",
                },
            ],
        }
    ],
)

print(response.output_text)

An input_image part can use either image_url or file_id, not both. Images are allowed in supported user/developer or tool-output positions, but not in system or assistant messages. DeepSeek’s Responses implementation is stateless: do not depend on previous_response_id, conversation, store, or background to preserve image context between calls. Read the dated DeepSeek Responses compatibility audit alongside the current official guide before migrating stateful OpenAI code.

Anthropic-compatible Messages image input

The Anthropic-compatible base URL is https://api.deepseek.com/anthropic. Use an image block whose source.type is base64, url, or file.

This example disables thinking explicitly for a plain image description and collects all returned text blocks. Do not assume the first content block has a text attribute: the Anthropic-compatible contract supports multiple block types. The response-reading correction is documentation-based, not a new live Vision test.

import os
import anthropic

client = anthropic.Anthropic(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com/anthropic",
)

message = client.messages.create(
    model="deepseek-v4-flash-vision-exp",
    max_tokens=1024,
    thinking={"type": "disabled"},
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe the visible error."},
                {
                    "type": "image",
                    "source": {
                        "type": "url",
                        "url": "https://example.com/error.png",
                    },
                },
            ],
        }
    ],
)

text = "\n".join(block.text for block in message.content if block.type == "text")
if not text.strip():
    raise RuntimeError("No text block was returned; inspect stop_reason and response content.")
print(text)

For Base64, include the validated media_type and raw Base64 data. For a stored file, use source.type: "file" with the file_id and send the required anthropic-beta: files-api-2025-04-14 header. Anthropic type: "document" remains unsupported even though type: "image" is now supported for Vision Exp. See the current Anthropic compatibility guide.

DeepSeek Vision formats, limits, and detail settings

LimitDocumented valueApplies to
Supported formatsJPEG, PNG, GIF, WebPAll vision input methods
Request body48 MiBInline request payload
One URL/inline image32 MiBURL and inline image input
One Files API image64 MiBfile_id
Images per requestUp to 600Combined image input
Total image bytes64 MiB without file_id; 200 MiB when files are referencedCombined images in one request
Public URL length8,192 charactersHTTP(S) URL input
Public URL download60 secondsRemote fetch
Image-token ceiling384 input tokens per image after resizingBilling and context

Choose the image detail setting

detailDocumented behaviorUse case
lowDownscales to 512 × 512 before inferenceCoarse layout, scene, or classification where fine text is not needed
highKeeps the original image; compatibility alias for originalSmall labels and fine detail
originalKeeps the original imageExplicit full-detail processing
autoCurrently equivalent to originalAccept the current automatic behavior

Each image is resized and counted independently. The 384-token figure is a maximum image-token contribution after DeepSeek’s image processing, not a guarantee of accuracy and not a replacement for byte, dimension, or request-count validation.

Image tokens and current pricing

DeepSeek converts every image into input tokens and bills those tokens with the accompanying text. The image contribution is capped at 384 input tokens per image after DeepSeek’s resizing step, but use the API response’s usage object for real cost calculations. Prices and time-based rates can change, so check our maintained DeepSeek API pricing guide and the official pricing page instead of copying a fixed price table into production estimates.

Why older DeepSeek image-input guidance said “no”

Before August 21, 2026, DeepSeek’s documented hosted V4 catalog exposed only text models, so older articles and screenshots correctly described image input as unsupported at that time. The release of deepseek-v4-flash-vision-exp changed the current contract. Treat dated text-only guidance as historical; use the request shapes and limits on this page for the current experimental Vision model.

Security and production checklist for image input

  • Keep DEEPSEEK_API_KEY in a server-side secret store. Never expose it in browser JavaScript, mobile bundles, public repositories, screenshots, or client-visible logs.
  • Validate file signatures, decoded dimensions, total pixels, byte size, and format before creating a data URL or Files API upload.
  • For user-supplied URLs, block private, loopback, link-local, and cloud-metadata destinations; re-check redirects to reduce SSRF risk.
  • Treat text visible inside images as untrusted data. A screenshot can contain prompt-injection instructions designed to reveal secrets or override the actual task.
  • Delete stored images when no longer needed, or set an explicit expiry aligned with the product’s retention policy.
  • Log file identifiers and request metadata without logging image bytes, signed URLs, credentials, or unnecessary personal information.
  • Validate Vision Exp on your own screenshots, charts, OCR languages, rotations, low contrast, tiny labels, and failure cases. “Experimental” is a meaningful release status.
  • Require human review for medical, legal, financial, identity, safety, access-control, or other high-impact conclusions drawn from images.

Troubleshooting DeepSeek vision requests

The API says the model does not support images

Confirm that model is exactly deepseek-v4-flash-vision-exp. Flash and Pro are not image-input models. Also check that the image is in a user message for Chat Completions.

A public image URL fails

Check public reachability without login cookies, URL expiry, redirects, URL length, download time, actual content type, and the 32 MiB per-image limit. Use Base64 or Files API when a stable public URL is not appropriate.

The request is too large

Base64 increases payload size and counts toward the 48 MiB body limit. Resize or recompress the image where quality allows, or upload it once and reference a Files API file_id.

Anthropic file input returns an error

Use the Anthropic base URL, an image block with source.type: "file", and the required anthropic-beta: files-api-2025-04-14 header. Do not send a document block or copy the OpenAI Chat Completions block unchanged.

The result misses small text or chart labels

Avoid detail: "low" when fine text matters. Supply a sharper crop, preserve the original image, state exactly which fields to extract, and require uncertainty to be reported. Verify critical values against the source image.

Frequently asked questions

Does the DeepSeek API accept images?

Yes. The experimental deepseek-v4-flash-vision-exp model accepts JPEG, PNG, GIF, and WebP images through public URL, Base64, or Files API file_id. The capability was released on August 21, 2026.

What is the DeepSeek vision API model ID?

Use the exact model ID deepseek-v4-flash-vision-exp. It is experimental. Do not invent a shortened vision name or use deepseek-v4-flash for image input.

Can I send an image URL to DeepSeek?

Yes, with Vision Exp. Put a public HTTP(S) URL inside an image_url block for Chat Completions or an input_image part for Responses. The URL must meet the official length, download-time, format, and image-size limits.

Does DeepSeek support Base64 image input?

Yes. Vision Exp accepts a Base64 data URL through Chat Completions and Responses; the Anthropic-compatible format uses an image source with type: "base64", a supported media_type, and the raw Base64 data.

Can I reuse an uploaded image with file_id?

Yes. Upload a supported image with Files API using purpose: "user_data", then reference the returned file_id in later Vision Exp requests. Files API operations are free, but image inference is billed.

Can the DeepSeek Files API upload PDFs or documents?

No. The current Files API documentation supports JPEG, PNG, GIF, and WebP images only. Anthropic type: "document" and general file inputs remain unsupported.

Can DeepSeek Vision Exp generate images?

No. Vision Exp understands image input and returns text. It is not a hosted text-to-image or image-editing endpoint. DeepSeek’s separate open-weight Janus family has different understanding and generation capabilities and is not the same API model.

Do deepseek-v4-flash and deepseek-v4-pro accept images?

No. Flash and Pro remain text-only hosted models. Select deepseek-v4-flash-vision-exp for native image input, or preprocess the image with an approved OCR/vision component and send text to Flash or Pro.

Conclusion

The DeepSeek API now has native image understanding through deepseek-v4-flash-vision-exp. Use a public URL for an already hosted image, Base64 for a small one-time local input, or Files API file_id for large or reusable images. Keep three boundaries clear: Vision Exp is experimental, Files API currently accepts images rather than general documents, and image understanding is not image generation.

Before production use, validate your actual image tasks, secure remote fetch and uploads, track file retention, inspect returned usage, and re-check the official Vision guide and pricing page for changes.

Official DeepSeek sources