DeepSeek v4 Flash Vision Experimental Model – API Guide and Community Insights
TL;DR
DeepSeek 發佈了 deepseek‑v4‑flash‑vision‑exp 模型,該模型可透過 OpenAI‑compatible 終端點進行文本與圖像(JPEG, PNG, GIF, WebP)的混合輸入,提供三種上傳方式、基於 token 的計費方式,以及明確的尺寸/維度限制。
What the model does
- 可以在單一請求中同時接收圖像與文本,實現描述、OCR、圖表分析等功能。
- 支援 JPEG, PNG, GIF, WebP 格式;檢測是基於文件內容,而非文件名或 MIME type。
How to send images
所有方法都使用 OpenAI‑compatible 的 chat.completions.create payload,其中 content 是一個 block 陣列。
1. Inline Base64 data URL
import base64, openai
client = openai.OpenAI(api_key="<key>", base_url="https://api.deepseek.com")
with open("image.jpg", "rb") as f:
b64 = base64.b64encode(f.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":"data:image/jpeg;base64,{b64}"}}]}],
)
print(resp.choices[0].message.content)
*這會計入 48 MiB 的請求體限制。
2. External URL
{"type":"image_url","image_url":{"url":"https://example.com/image.jpg"}}
- URL 長度 $\le$ 8192 字元。
- 圖像文件 $\le$ 12 MiB。
- 下載必須在 60 秒內完成。
3. Files API reference
透過 Files API 上傳一次,然後使用返回的 file_id:
{"type":"file","file_id":"file-api-xxxxxxxx"}
- 允許圖像大小至至 64 MiB。
- 繞過 48 MiB 的 inline 限制,非常適合用於多次請求中的重用。
Inline file data alternative
{"type":"file","file_data":"data:image/jpeg;base64,<BASE64>","filename":"image.jpg"}
n```
*(`file_data` 與 `file_id` 是互斥的.)*
---
## Controlling image detail
對於 `image_url` blocks,您可以設置 `detail` 欄位:
| Value | Effect |
|---|---|
| `low` | 在推理前將圖像縮放至 ism 512×512 (更便宜、更快速)。 |
| `high` / `original` | 保留原圖解析度。
| `auto` | 目前等同於 `original`。
Example:
```json
{"type":"image_url","image_url":{"url":"https://example.com/img.jpg","detail":"low"}}
When to prefer the Files API
請求體會超過 4 effective 48 MiB。
圖像大小 > 32 MiB (僅能透過 Files API 上傳).
同一張圖會用於多次請求。
Files API 的優點是
hought
}],
Sources
相關
- Dispatch
- Dispatch
- Dispatch
- Dispatch