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 チャット APIリファレンス
OpenAI互換の Chat Completions API リファレンスと、deepseek-v4-flash-vision-exp のためのプレイグラウンドです。画像の送信方法は3通りあり、token の節約の詳細や推論の切り替えも確認できます。デフォルトグループの token が必要です。
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>"
}
}default グループに token が含まれていることを確認してください。ClaudeCode の token でもここでは 200 が返りますが、detail、thinking の切り替えと logprobs は
すべて動作しなくなり、レスポンスから completion_tokens_details フィールドが消えます —— そのため、
パラメータの指定を間違えたように見えますが、実際にはグループが違うだけです。Anthropic 形式の場合は、代わりに
メッセージ プレイグラウンド を使用してください。Bearer sk-your-api-key を
認証 に入れてください。例では公開画像を使用し、thinking は無効になっているため、送信を押すと
すぐにレスポンスを確認できます。ローカルファイルの場合は、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 をオフにし、入力 tokens を 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 | — | Function Call。構造化出力では json_schema の代わりにこれを使用してください |
画像を送信する3つの方法
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 です)。
detail の file ブロック上での指定は黙って無視されます —— エラーにもならず、保存もされません。
detail: "low" を使うには、画像を image_url チャネル経由で送信してください。また、file_id(Files API)はこのプラットフォームでは利用できません。渡すと
invalid file_id が返されます。detailでどれだけ節約できるか
4つのレベルすべてで同じ1600×1200画像:
detail | 画像 tokens | 対 original |
|---|---|---|
low | 142 | -60% |
high | 354 | 同じ |
original | 354 | ベースライン |
auto | 354 | 同じ |
low は、画像の種類の判別、被写体の認識、または大まかな分類には十分です。
小さな文字やグラフの数値を読むには original を使ってください。
列挙外の値ははっきりとエラーになります:
unknown variant 'ultra', expected one of 'low', 'high', 'original', 'auto'.
画像が token になる仕組み
| 画像サイズ | Tokens |
|---|---|
| 64×64 | 114 |
| 384×384 | 114 |
| 800×800 | 346 |
| 2000×2000 | 346 |
| 4000×4000 | 346 |
| 1600×400 | 266 |
| 1600×1200 | 354 |
推論を無効にする2つの方法
{ "thinking": { "type": "disabled" } }
{ "reasoning_effort": "none" }
prompt_tokens は 303 から 223 に下がり、reasoning_content
は消えます)。reasoning: {"effort": "none"} と enable_thinking: false は 動作しません。
max_tokens が小さすぎると空の content が返ります。 推論を有効にしていると、1行の
質問でも最初に数百 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 | 画像が 32 MiB を超えています |
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 がありません |
承認
The API Key from the APIYI console; the token must be in the default group
ボディ
Model ID, always deepseek-v4-flash-vision-exp
deepseek-v4-flash-vision-exp Message array. content is either a plain string or an array of content parts for mixed text and images
Show child attributes
Show child attributes
Output token budget, hard ceiling 393,216. Thinking text counts against it, so use 2000 or more with thinking on, otherwise content may come back empty
x <= 393216Thinking toggle. Pass {"type": "disabled"} to turn it off, saving 80 input tokens and all reasoning output. Only effective in the default group
Show child attributes
Show child attributes
Reasoning depth. In testing none reliably disables thinking; low/high/max showed no stable difference. Only effective in the default group
none, low, medium, high, max Stream the response over SSE. Pair with stream_options.include_usage to get usage in the final chunk
Output format. Only {"type": "json_object"} works; json_schema returns This response_format type is unavailable now
Show child attributes
Show child attributes
Sampling temperature
Nucleus sampling threshold
Stop sequences
Random seed
Return token log probabilities; populated in testing (default group only)
Number of candidates per position, range 0-20
0 <= x <= 20Function Call tool list in OpenAI format. Use it instead of json_schema when you need structured output
このページは役に立ちましたか?