Chat completion with vision: DeepSeek V4 Flash Vision
curl --request POST \
--url https://api.apiyi.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepseek-v4-flash-vision-exp",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://docs.apiyi.com/images/checks-passed.png",
"detail": "original"
}
}
]
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "deepseek-v4-flash-vision-exp",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://docs.apiyi.com/images/checks-passed.png",
"detail": "original"
}
}
]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'deepseek-v4-flash-vision-exp',
messages: [
{
role: 'user',
content: [
{type: 'text', text: 'What is in this image? Answer in one sentence.'},
{
type: 'image_url',
image_url: {url: 'https://docs.apiyi.com/images/checks-passed.png', detail: 'original'}
}
]
}
]
})
};
fetch('https://api.apiyi.com/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'deepseek-v4-flash-vision-exp',
'messages' => [
[
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'What is in this image? Answer in one sentence.'
],
[
'type' => 'image_url',
'image_url' => [
'url' => 'https://docs.apiyi.com/images/checks-passed.png',
'detail' => 'original'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is in this image? Answer in one sentence.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\",\n \"detail\": \"original\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is in this image? Answer in one sentence.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\",\n \"detail\": \"original\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is in this image? Answer in one sentence.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\",\n \"detail\": \"original\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "35a4e262-f2b8-4eb7-bdb2-012b02c7012d",
"object": "chat.completion",
"model": "deepseek-v4-flash-vision-exp",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image shows a notification stating that all checks have passed, including a successful Mintlify deployment."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 295,
"completion_tokens": 49,
"total_tokens": 344,
"prompt_cache_hit_tokens": 0,
"prompt_cache_miss_tokens": 295
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}DeepSeek V4 Flash Vision
DeepSeek V4 Flash Vision Chat API Reference
OpenAI-compatible Chat Completions API reference and playground for deepseek-v4-flash-vision-exp: three ways to send images, detail token savings, thinking toggle. Requires a default-group token.
POST
/
v1
/
chat
/
completions
Chat completion with vision: DeepSeek V4 Flash Vision
curl --request POST \
--url https://api.apiyi.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepseek-v4-flash-vision-exp",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://docs.apiyi.com/images/checks-passed.png",
"detail": "original"
}
}
]
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "deepseek-v4-flash-vision-exp",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://docs.apiyi.com/images/checks-passed.png",
"detail": "original"
}
}
]
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'deepseek-v4-flash-vision-exp',
messages: [
{
role: 'user',
content: [
{type: 'text', text: 'What is in this image? Answer in one sentence.'},
{
type: 'image_url',
image_url: {url: 'https://docs.apiyi.com/images/checks-passed.png', detail: 'original'}
}
]
}
]
})
};
fetch('https://api.apiyi.com/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'deepseek-v4-flash-vision-exp',
'messages' => [
[
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'What is in this image? Answer in one sentence.'
],
[
'type' => 'image_url',
'image_url' => [
'url' => 'https://docs.apiyi.com/images/checks-passed.png',
'detail' => 'original'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is in this image? Answer in one sentence.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\",\n \"detail\": \"original\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is in this image? Answer in one sentence.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\",\n \"detail\": \"original\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What is in this image? Answer in one sentence.\"\n },\n {\n \"type\": \"image_url\",\n \"image_url\": {\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\",\n \"detail\": \"original\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "35a4e262-f2b8-4eb7-bdb2-012b02c7012d",
"object": "chat.completion",
"model": "deepseek-v4-flash-vision-exp",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image shows a notification stating that all checks have passed, including a successful Mintlify deployment."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 295,
"completion_tokens": 49,
"total_tokens": 344,
"prompt_cache_hit_tokens": 0,
"prompt_cache_miss_tokens": 295
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Check that your token is in the
default group before you test.A ClaudeCode token still returns 200 here, but detail, the thinking toggle and logprobs
all stop working and the response drops its completion_tokens_details field —— it looks like
you wrote the parameters wrong when in fact the group is wrong. For the Anthropic format use the
Messages Playground instead.Use the playground on the right to test directly: put
Bearer sk-your-api-key in
Authorization. The example uses a public image and has thinking disabled, so you can hit send
and see a response immediately. For a local file, change image_url.url to
data:image/jpeg;base64,<BASE64>.Parameter quick reference
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
model | string | ✓ | — | Always deepseek-v4-flash-vision-exp |
messages | array | ✓ | — | content is a string, or an array of parts for mixed text and images |
max_tokens | int | — | Output budget, hard ceiling 393,216; use 2000+ with thinking on | |
thinking.type | string | enabled | disabled reliably turns thinking off and saves 80 input tokens | |
reasoning_effort | string | — | none is equivalent to disabling thinking; low/high/max show no stable difference | |
response_format | object | — | Only json_object works; json_schema errors out | |
stream | bool | false | SSE streaming; pair with stream_options.include_usage for usage | |
temperature / top_p / stop / seed | — | — | All effective | |
logprobs / top_logprobs | — | — | Effective; top_logprobs range is 0–20 | |
tools | array | — | Function Call; use it instead of json_schema for structured output |
Three ways to send an image
image_url with a base64 data URL
{
"type": "image_url",
"image_url": {"url": "data:image/jpeg;base64,<BASE64>", "detail": "original"}
}
image_url with a public link
{
"type": "image_url",
"image_url": {"url": "https://example.com/image.jpg", "detail": "low"}
}
A file block with file_data
{
"type": "file",
"file_data": "data:image/jpeg;base64,<BASE64>",
"filename": "image.jpg"
}
image_url channel (303 for the same image either way).
detail on a file block is silently ignored —— no error, and no saving either.
To use detail: "low", send the image through the image_url channel.Also, file_id (the Files API) is unavailable on this platform; passing one returns
invalid file_id.How much detail saves
The same 1600×1200 image at all four levels:
detail | Image tokens | vs. original |
|---|---|---|
low | 142 | -60% |
high | 354 | same |
original | 354 | baseline |
auto | 354 | same |
low is enough for identifying an image type, recognising the subject or rough classification.
Reserve original for reading small text or chart values.
An out-of-enum value fails loudly:
unknown variant 'ultra', expected one of 'low', 'high', 'original', 'auto'.
How images become tokens
| Image size | Tokens |
|---|---|
| 64×64 | 114 |
| 384×384 | 114 |
| 800×800 | 346 |
| 2000×2000 | 346 |
| 4000×4000 | 346 |
| 1600×400 | 266 |
| 1600×1200 | 354 |
Two ways to disable thinking
{ "thinking": { "type": "disabled" } }
{ "reasoning_effort": "none" }
prompt_tokens drops from 303 to 223 and reasoning_content
disappears). reasoning: {"effort": "none"} and enable_thinking: false do not work.
Too small a
max_tokens returns an empty content. With thinking on, even a one-line
question can emit several hundred tokens of reasoning first; once the budget runs out you get
finish_reason: "length" and an empty string —— easily mistaken for the model failing to answer.
Use 2000 or more with thinking on, or simply disable it.Need structured output? Use tools
response_format: {"type": "json_schema"} returns
This response_format type is unavailable now (an upstream model limitation).
json_object works but does not constrain fields. For enforcement, use Function Call:
{
"model": "deepseek-v4-flash-vision-exp",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Look at the image and call record_shape."},
{"type": "image_url", "image_url": {"url": "https://example.com/shape.jpg"}}
]
}],
"tools": [{
"type": "function",
"function": {
"name": "record_shape",
"parameters": {
"type": "object",
"properties": {
"shape": {"type": "string"},
"color": {"type": "string"}
},
"required": ["shape", "color"]
}
}
}]
}
Common errors
| Error | Cause |
|---|---|
You have uploaded an unsupported image | Format is not JPEG/PNG/GIF/WebP, or the base64 is corrupt |
Failed to download image | The URL is unreachable or took over 60 seconds |
image file size exceeds limit 32 MB | The image is larger than 32 MiB |
external link length … too long, max link length 8192 | The URL is too long |
Image in assistant message is unsupported | Images may only appear in user messages |
valid range of max_tokens is [1, 393216] | max_tokens is above the ceiling |
invalid file_id | You used file_id; this platform offers no Files API |
Authorizations
Body
application/json
Was this page helpful?