对话补全:DeepSeek V4 Flash 文本生成
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-ga-260731",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "deepseek-v4-flash-ga-260731",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
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-ga-260731',
messages: [{role: 'user', content: '用一句话介绍你自己'}]
})
};
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-ga-260731',
'messages' => [
[
'role' => 'user',
'content' => '用一句话介绍你自己'
]
]
]),
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-ga-260731\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\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-ga-260731\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\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-ga-260731\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"choices": [
{}
],
"usage": {}
}DeepSeek V4 Flash
DeepSeek V4 Flash Chat API 参考
DeepSeek V4 Flash 正式版(deepseek-v4-flash-ga-260731)Chat Completions API 参考与在线调试:OpenAI 兼容格式,1M 上下文,支持思考开关与隐式缓存。
POST
/
v1
/
chat
/
completions
对话补全:DeepSeek V4 Flash 文本生成
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-ga-260731",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "deepseek-v4-flash-ga-260731",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
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-ga-260731',
messages: [{role: 'user', content: '用一句话介绍你自己'}]
})
};
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-ga-260731',
'messages' => [
[
'role' => 'user',
'content' => '用一句话介绍你自己'
]
]
]),
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-ga-260731\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\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-ga-260731\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\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-ga-260731\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"choices": [
{}
],
"usage": {}
}右侧 Playground 可直接调试:在 Authorization 填
Bearer sk-your-api-key,
默认示例已关闭深度思考(thinking.disabled),点击发送即可快速看到响应。该模型默认思考量偏大,一句话问题也会先输出数百 tokens 思考内容。调试建议保持示例中的
"thinking": {"type": "disabled"}。模型能力、定价、缓存机制详见
DeepSeek V4 Flash 概览。- 开启思考时
max_tokens要给足(思考内容计入输出配额),建议 3000+ response_format不生效:传json_schema返回 200 但完全无视 schema,需要结构化输出请用toolsn参数静默忽略:传n=2返回 200,但choices里恒为 1 个元素- 纯文本模型,传图片内容块会报
Model do not support image input
参数说明速查
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
model | string | ✓ | — | 固定 deepseek-v4-flash-ga-260731 |
messages | array | ✓ | — | OpenAI 标准消息数组,纯文本 |
max_tokens | int | — | 输出配额,硬上限 393,216;开思考时建议 3000+ | |
thinking.type | string | enabled | disabled 可靠关闭思考;另有 auto | |
reasoning_effort | string | — | 仅 minimal 确定性生效(思考 tokens 恒为 0);low/medium/high/max 非单调,见概览 | |
stream | bool | false | SSE 流式,配合 stream_options.include_usage 回传用量 | |
temperature / top_p | number | — | 采样参数,均生效 | |
stop | array | — | 停止词,实测真实截断 | |
seed / logprobs | — | — | 均生效 | |
tools | array | — | Function Call,工具参数是真正被约束的 |
上下文与输出上限
| 项目 | 硬上限 | 触发的报错 |
|---|---|---|
| 输入 | 1,048,570 tokens | Input length ... exceeds the maximum length 1048570 |
输出 max_tokens | 393,216 | integer above maximum value, expected a value <= 393216 |
隐式缓存
无需任何参数,相同长前缀第 2 次请求即命中:| 轮次 | prompt_tokens | cached_tokens | 命中率 |
|---|---|---|---|
| 1 | 15,634 | 0 | — |
| 2 | 15,634 | 15,616 | 99.9% |
| 3 | 15,634 | 15,616 | 99.9% |
需要结构化输出?用 tools
{
"model": "deepseek-v4-flash-ga-260731",
"messages": [{"role": "user", "content": "北京今天 25 度"}],
"tools": [{
"type": "function",
"function": {
"name": "submit_result",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"},
"temp_c": {"type": "number"}
},
"required": ["city", "temp_c"]
}
}
}]
}
choices[0].message.tool_calls[0].function.arguments 取 JSON 字符串,可直接解析。授权
在 API易控制台获取的 API Key
请求体
application/json
模型 ID,固定 deepseek-v4-flash-ga-260731
可用选项:
deepseek-v4-flash-ga-260731 对话消息数组,OpenAI 标准格式。纯文本,不支持图片内容块
Show child attributes
Show child attributes
最大输出 tokens,硬上限 393,216。开启思考时思考内容也计入,建议给足
必填范围:
x <= 393216深度思考开关。传 {"type": "disabled"} 可关闭,实测简单任务可省 200+ 思考 tokens
Show child attributes
Show child attributes
思考深度分档。实测仅 minimal 确定性生效(思考 tokens 恒为 0);low/medium/high/max 不构成单调阶梯,档内方差大于档间差异
可用选项:
minimal, low, medium, high, max 是否流式输出(SSE)。配合 stream_options.include_usage 可在末尾获取用量
采样温度
核采样阈值
停止词,实测真实截断生效
随机种子
是否返回 token 对数概率,实测有内容返回
Function Call 工具列表,OpenAI 标准格式。工具参数是真正被约束的,需要结构化输出时用它替代 response_format
此页面对您有帮助吗?
⌘I