curl --request POST \
--url https://api.apiyi.com/v1/messages \
--header 'Content-Type: application/json' \
--header 'anthropic-version: <anthropic-version>' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "deepseek-v4-flash-vision-exp",
"max_tokens": 800,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://docs.apiyi.com/images/checks-passed.png"
}
}
]
}
]
}
'import requests
url = "https://api.apiyi.com/v1/messages"
payload = {
"model": "deepseek-v4-flash-vision-exp",
"max_tokens": 800,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://docs.apiyi.com/images/checks-passed.png"
}
}
]
}
]
}
headers = {
"anthropic-version": "<anthropic-version>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'anthropic-version': '<anthropic-version>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'deepseek-v4-flash-vision-exp',
max_tokens: 800,
messages: [
{
role: 'user',
content: [
{type: 'text', text: 'What is in this image? Answer in one sentence.'},
{
type: 'image',
source: {type: 'url', url: 'https://docs.apiyi.com/images/checks-passed.png'}
}
]
}
]
})
};
fetch('https://api.apiyi.com/v1/messages', 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/messages",
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',
'max_tokens' => 800,
'messages' => [
[
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'What is in this image? Answer in one sentence.'
],
[
'type' => 'image',
'source' => [
'type' => 'url',
'url' => 'https://docs.apiyi.com/images/checks-passed.png'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"anthropic-version: <anthropic-version>",
"x-api-key: <api-key>"
],
]);
$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/messages"
payload := strings.NewReader("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"max_tokens\": 800,\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\",\n \"source\": {\n \"type\": \"url\",\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("anthropic-version", "<anthropic-version>")
req.Header.Add("x-api-key", "<api-key>")
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/messages")
.header("anthropic-version", "<anthropic-version>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"max_tokens\": 800,\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\",\n \"source\": {\n \"type\": \"url\",\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["anthropic-version"] = '<anthropic-version>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"max_tokens\": 800,\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\",\n \"source\": {\n \"type\": \"url\",\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "a5cb230d-ac08-43ed-8c4b-8f88b37119d3",
"type": "message",
"role": "assistant",
"model": "deepseek-v4-flash-vision-exp",
"content": [
{
"type": "text",
"text": "The image shows a notification stating that all checks have passed, including a successful Mintlify deployment."
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 295,
"output_tokens": 51,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}{
"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 ビジョン メッセージ API リファレンス
Anthropicネイティブ /v1/messages API リファレンスと、deepseek-v4-flash-vision-exp 向けのプレイグラウンド: base64 と URL の画像ソース、thinking の切り替え、完全な tool ラウンドトリップ。ClaudeCodeグループの token が必要です。
curl --request POST \
--url https://api.apiyi.com/v1/messages \
--header 'Content-Type: application/json' \
--header 'anthropic-version: <anthropic-version>' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "deepseek-v4-flash-vision-exp",
"max_tokens": 800,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://docs.apiyi.com/images/checks-passed.png"
}
}
]
}
]
}
'import requests
url = "https://api.apiyi.com/v1/messages"
payload = {
"model": "deepseek-v4-flash-vision-exp",
"max_tokens": 800,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image? Answer in one sentence."
},
{
"type": "image",
"source": {
"type": "url",
"url": "https://docs.apiyi.com/images/checks-passed.png"
}
}
]
}
]
}
headers = {
"anthropic-version": "<anthropic-version>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'anthropic-version': '<anthropic-version>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'deepseek-v4-flash-vision-exp',
max_tokens: 800,
messages: [
{
role: 'user',
content: [
{type: 'text', text: 'What is in this image? Answer in one sentence.'},
{
type: 'image',
source: {type: 'url', url: 'https://docs.apiyi.com/images/checks-passed.png'}
}
]
}
]
})
};
fetch('https://api.apiyi.com/v1/messages', 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/messages",
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',
'max_tokens' => 800,
'messages' => [
[
'role' => 'user',
'content' => [
[
'type' => 'text',
'text' => 'What is in this image? Answer in one sentence.'
],
[
'type' => 'image',
'source' => [
'type' => 'url',
'url' => 'https://docs.apiyi.com/images/checks-passed.png'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"anthropic-version: <anthropic-version>",
"x-api-key: <api-key>"
],
]);
$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/messages"
payload := strings.NewReader("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"max_tokens\": 800,\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\",\n \"source\": {\n \"type\": \"url\",\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\"\n }\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("anthropic-version", "<anthropic-version>")
req.Header.Add("x-api-key", "<api-key>")
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/messages")
.header("anthropic-version", "<anthropic-version>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"max_tokens\": 800,\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\",\n \"source\": {\n \"type\": \"url\",\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\"\n }\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["anthropic-version"] = '<anthropic-version>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"deepseek-v4-flash-vision-exp\",\n \"max_tokens\": 800,\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\",\n \"source\": {\n \"type\": \"url\",\n \"url\": \"https://docs.apiyi.com/images/checks-passed.png\"\n }\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "a5cb230d-ac08-43ed-8c4b-8f88b37119d3",
"type": "message",
"role": "assistant",
"model": "deepseek-v4-flash-vision-exp",
"content": [
{
"type": "text",
"text": "The image shows a notification stating that all checks have passed, including a successful Mintlify deployment."
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 295,
"output_tokens": 51,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}{
"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>"
}
}ClaudeCode グループに含まれていなければなりません。これは必須条件です。default グループを使うと、2つの問題が重なって発生します。top_pを省略すると、毎回 400Invalid top_p valueが返りますtop_pを指定しても、最初のターンのthinkingブロックを2回目のターンに再送するとunknown variant 'thinking', expected one of 'text', 'image_url', 'file'が返ります —— そして Claude Code や Anthropic SDK などの標準クライアントは常にこれを再送するため、 マルチターンは常に壊れます
ClaudeCode グループに切り替えれば、どちらの問題も発生しません。OpenAI フォーマットの場合は、
代わりに Chat Playground をご利用ください。sk-your-apiyi-key を入れ
(ClaudeCode token で、Bearer プレフィックスはありません)、anthropic-version は 2023-06-01 のままにしてください。
この例では公開画像を使用し、thinking は無効化されているため、送信するとすぐに
response を確認できます。パラメータのクイックリファレンス
| パラメータ | 型 | 必須 | デフォルト | 備考 |
|---|---|---|---|---|
model | string | ✓ | — | 常にdeepseek-v4-flash-vision-exp |
max_tokens | int | ✓ | — | Anthropic 形式では必須で、絶対上限は 393,216 です。thinking を有効にする場合は 2000 以上を使用してください |
messages | array | ✓ | — | content は string、または content blocks の配列です |
system | string | — | システム prompt | |
thinking.type | string | enabled | disabled にすると content に text ブロックのみが残ります | |
thinking.budget_tokens | int | — | enabled のときの thinkingBudget | |
stream | bool | false | 標準の Anthropic イベントシーケンスによる SSE ストリーミング | |
top_p | number | — | ClaudeCode グループでは任意 | |
temperature / top_k / stop_sequences | — | — | すべて有効 | |
tools | array | — | 標準の Anthropic input_schema 形式 |
画像を送信する2つの方法
source.type = "base64"
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "<BASE64>"
}
}
data には data:image/jpeg;base64, プレフィックスがありません——これは
OpenAI 形式とは異なります。
source.type = "url"
{
"type": "image",
"source": {"type": "url", "url": "https://example.com/image.jpg"}
}
source.type = "url" は ClaudeCode グループでのみ機能します。default グループでは
You have uploaded an unsupported image が返されます。source.type = "file" には Files API が必要ですが、このプラットフォームでは提供していません。レスポンス content は block 配列です
| ケース | content |
|---|---|
| デフォルト(thinking 有効) | [{"type": "thinking", ...}, {"type": "text", ...}] |
thinking.type = "disabled" | [{"type": "text", ...}] |
| ツールを呼び出すとき | [{"type": "thinking", ...}, {"type": "tool_use", ...}] |
ClaudeCode グループでは、thinking ブロックに signature フィールドが含まれ、ストリーミングでは signature_delta も出力されます。
マルチターンとツールの往復
前回のアシスタントターンのcontent全体をmessagesに戻してください—— thinking ブロックも含めて、
削除しないでください —— そして tool_result を追記します:
{
"model": "deepseek-v4-flash-vision-exp",
"max_tokens": 1500,
"tools": [{
"name": "record_shape",
"input_schema": {
"type": "object",
"properties": {
"shape": {"type": "string"},
"color": {"type": "string"}
},
"required": ["shape", "color"]
}
}],
"messages": [
{"role": "user", "content": [
{"type": "text", "text": "Look at the image and call record_shape."},
{"type": "image", "source": {"type": "url", "url": "https://example.com/shape.jpg"}}
]},
{"role": "assistant", "content": "<the content array returned by the previous turn, verbatim>"},
{"role": "user", "content": [
{"type": "tool_result", "tool_use_id": "<the tool_use id from the previous turn>", "content": "{\"ok\":true}"}
]}
]
}
default グループが 400 を返す場所です、
そしてこれはすべての Claude Code スタイルのクライアントがたどるパスです——だからこそ、グループは正しくなければなりません。
キャッシュフィールドの読み方
自動プレフィックスキャッシュが適用され、標準のAnthropicフィールドに対応します:| フィールド | 動作 |
|---|---|
cache_read_input_tokens | 自動プレフィックスのキャッシュヒットサイズ。ヒットは最初の画像の前で止まります。画像自体は決してキャッシュされません |
cache_creation_input_tokens | 常に0です。 上流側は自動プレフィックスキャッシュを使用し、明示的なcache_controlマーカーは無視します |
input_tokens | ヒット後は、OpenAI形式のprompt_tokensとは異なり、ここにはキャッシュされていない残り部分のみが入ります。OpenAI形式のprompt_tokensは常に全件数です。両者は直接は整合しません |
よくあるエラー
| エラー | 原因 |
|---|---|
Invalid top_p value, the valid range of top_p is (0, 1.0] | default グループ token で top_p がない —— ClaudeCode に切り替えてください |
unknown variant 'thinking' | default グループ token が thinking ブロックを再生している —— ClaudeCode に切り替えてください |
You have uploaded an unsupported image | サポートされていない形式、または default グループ token に source.type = "url" がある |
Image in assistant message is unsupported | 画像は user メッセージにのみ表示できます |
image file size exceeds limit 32 MB | 画像のサイズが 32 MiB を超えています |
承認
Your APIYI token, the raw sk- key. The token must be in the ClaudeCode group
ヘッダー
Anthropic API version, always 2023-06-01
ボディ
Model ID, always deepseek-v4-flash-vision-exp
deepseek-v4-flash-vision-exp Output token budget (required in the Anthropic format), hard ceiling 393,216. Use 2000 or more with thinking on
x <= 393216Message array. content is either a plain string or an array of content blocks for mixed text and images
Show child attributes
Show child attributes
System prompt
Thinking toggle. With {"type": "disabled"} the response content holds only a text block. Works in both groups on this endpoint
Show child attributes
Show child attributes
Stream the response over SSE, emitting the standard Anthropic message_start / content_block_delta / message_stop events
Sampling temperature
Nucleus sampling threshold. Optional in the ClaudeCode group; in the default group, omitting it returns 400
Candidate cutoff
Stop sequences
Tool list in the standard Anthropic input_schema format. Verified with streaming increments and a full two-turn round trip
レスポンス
Generation succeeded
Array of content blocks. [thinking, text] with thinking on, just [text] with it off, and [thinking, tool_use] when calling a tool
Usage. Note this differs from the OpenAI format: after a cache hit input_tokens holds only the uncached remainder, so it cannot be reconciled with prompt_tokens directly
Show child attributes
Show child attributes
このページは役に立ちましたか?