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 비전 채팅 API 레퍼런스
deepseek-v4-flash-vision-exp를 위한 OpenAI 호환 채팅 완성 API 레퍼런스 및 플레이그라운드입니다. 이미지를 전송하는 세 가지 방법과 token 절약 효과, 추론 토글을 자세히 설명합니다. 기본 그룹 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>"
}
}테스트하기 전에 token이
default 그룹에 있는지 확인하십시오.ClaudeCode token도 여기서는 여전히 200을 반환하지만, detail, 사고 토글 및 logprobs이
모두 작동을 멈추고 응답에서 completion_tokens_details 필드가 사라집니다 —— 실제로는 그룹이 잘못된 것인데
매개변수를 잘못 작성한 것처럼 보입니다. Anthropic 형식에는 대신
Messages Playground를 사용하십시오.오른쪽의 플레이그라운드를 사용하여 직접 테스트하십시오.
Bearer sk-your-api-key을
Authorization에 입력하십시오. 예제에서는 공개 이미지를 사용하고 사고 기능이 비활성화되어 있으므로 보내기를
눌러 즉시 응답을 확인할 수 있습니다. 로컬 파일의 경우 image_url.url을
data:image/jpeg;base64,<BASE64>로 변경하십시오.매개변수 빠른 참조
| 매개변수 | 유형 | 필수 | 기본값 | 비고 |
|---|---|---|---|---|
model | string | ✓ | — | 항상 deepseek-v4-flash-vision-exp |
messages | array | ✓ | — | content은 문자열이거나 혼합 텍스트 및 이미지용 파트 배열입니다 |
max_tokens | int | — | 출력 예산, 하드 상한 393,216; thinking을 활성화할 때는 2000 이상 사용하십시오 | |
thinking.type | string | enabled | disabled은 thinking을 확실히 끄고 입력 token 80개를 절약합니다 | |
reasoning_effort | string | — | none은 thinking을 비활성화하는 것과 동일합니다. low/high/max에서는 안정적인 차이가 나타나지 않습니다 | |
response_format | object | — | json_object만 작동하며, json_schema는 오류가 발생합니다 | |
stream | bool | false | SSE 스트리밍입니다. 사용량을 확인하려면 stream_options.include_usage와 함께 사용하십시오 | |
temperature / top_p / stop / seed | — | — | 모두 유효합니다 | |
logprobs / top_logprobs | — | — | 유효합니다. top_logprobs 범위는 0–20입니다 | |
tools | array | — | 함수 호출입니다. 구조화된 출력에는 json_schema 대신 사용하십시오 |
이미지를 전송하는 세 가지 방법
image_url과 base64 데이터 URL 사용
{
"type": "image_url",
"image_url": {"url": "data:image/jpeg;base64,<BASE64>", "detail": "original"}
}
image_url와 공개 링크 사용
{
"type": "image_url",
"image_url": {"url": "https://example.com/image.jpg", "detail": "low"}
}
file 블록과 file_data 사용
{
"type": "file",
"file_data": "data:image/jpeg;base64,<BASE64>",
"filename": "image.jpg"
}
image_url 채널과 동일합니다(어느 방법이든 동일한 이미지에 303).
file 블록의 detail은 조용히 무시됩니다 —— 오류도 발생하지 않으며 저장되지도 않습니다.
detail: "low"을 사용하려면 image_url 채널을 통해 이미지를 전송하십시오.또한, file_id(Files API)는 이 플랫폼에서 사용할 수 없습니다. 이를 전달하면
invalid file_id이 반환됩니다.detail이 얼마나 절약하는지
네 가지 수준에서 동일한 1600×1200 이미지:
detail | 이미지 token 수 | original 대비 |
|---|---|---|
low | 142 | -60% |
high | 354 | 동일 |
original | 354 | 기준값 |
auto | 354 | 동일 |
low이면 충분합니다.
작은 텍스트나 차트 값을 읽을 때는 original을 사용합니다.
열거형에 없는 값은 즉시 오류를 발생시킵니다:
unknown variant 'ultra', expected one of 'low', 'high', 'original', 'auto'.
이미지가 tokens가 되는 방식
| 이미지 크기 | tokens |
|---|---|
| 64×64 | 114 |
| 384×384 | 114 |
| 800×800 | 346 |
| 2000×2000 | 346 |
| 4000×4000 | 346 |
| 1600×400 | 266 |
| 1600×1200 | 354 |
사고를 비활성화하는 두 가지 방법
{ "thinking": { "type": "disabled" } }
{ "reasoning_effort": "none" }
prompt_tokens는 303에서 223으로 감소하고 reasoning_content는 사라집니다). reasoning: {"effort": "none"} 및 enable_thinking: false은 작동하지 않습니다.
너무 작은
max_tokens은 빈 content을 반환합니다. 사고를 활성화하면 한 줄짜리 질문도 먼저 수백 개의 reasoning token을 출력할 수 있습니다. 예산이 소진되면 finish_reason: "length"과 빈 문자열을 받게 되며 —— 이는 모델이 응답하지 못한 것으로 쉽게 오해할 수 있습니다.
사고를 활성화한 상태에서는 2000 이상을 사용하거나, 간단히 비활성화하십시오.구조화된 출력이 필요하십니까? 도구를 사용하십시오
response_format: {"type": "json_schema"}은
This response_format type is unavailable now을 반환합니다(상위 모델의 제한 사항입니다).
json_object은 작동하지만 필드를 제한하지 않습니다. 강제 적용하려면 함수 호출을 사용하십시오.
{
"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"]
}
}
}]
}
일반적인 오류
| 오류 | 원인 |
|---|---|
You have uploaded an unsupported image | 형식이 JPEG/PNG/GIF/WebP가 아니거나 base64가 손상되었습니다 |
Failed to download image | URL에 연결할 수 없거나 60초를 초과했습니다 |
image file size exceeds limit 32 MB | 이미지가 32MiB보다 큽니다 |
external link length … too long, max link length 8192 | URL이 너무 깁니다 |
Image in assistant message is unsupported | 이미지는 user 메시지에만 표시할 수 있습니다 |
valid range of max_tokens is [1, 393216] | max_tokens이 상한을 초과했습니다 |
invalid file_id | file_id을 사용했지만 이 플랫폼은 Files API를 제공하지 않습니다 |
인증
본문
application/json
이 페이지가 도움이 되었나요?