Gọi dòng V4 flagship 2026 của DeepSeek (V4-Pro và V4-Flash) thông qua endpoint /chat/completions thống nhất của TokenHub. Tương thích hoàn toàn với OpenAI — openai SDK chính thức hoạt động ngay mà không cần chỉnh sửa. Hỗ trợ streaming, dùng tool và chế độ thinking với reasoning_content. Cửa sổ ngữ cảnh 1M, max output 384K, tính phí theo Token dựa trên bảng giá catalog của DeepSeek.
th-xxxxxxxxxxxx...)https://tokenhub.store/api/v1Gửi API Key trong header Authorization:
Authorization: Bearer th-your-api-keyPOST/chat/completionsChat completion. Schema giống như OpenAI /v1/chat/completions, với streaming, tools, JSON mode và các trường thinking riêng của DeepSeek.
Giá được tính theo mỗi 1 triệu tokens (USD), dựa trên giá niêm yết catalog của DeepSeek (không áp dụng chiết khấu khuyến mãi). Chấp nhận cả ID chuẩn và bí danh deepseek/*. Việc tính phí sử dụng completion_tokens do upstream trả về (đã bao gồm reasoning_tokens).
| Hạng | Model ID | Input | Output | Ghi chú |
|---|---|---|---|---|
| V4-Pro | deepseek-v4-pro | $1.80 | $3.60 | Flagship cao cấp nhất 2026. Chất lượng reasoning & coding tốt nhất. |
| V4-Flash | deepseek-v4-flash | $0.15 | $0.30 | Flagship cực kỳ tiết kiệm chi phí, rẻ hơn Pro khoảng 12×; lựa chọn mặc định tuyệt vời cho production. |
| Tham số | Kiểu | Bắt buộc | Mặc định | Mô tả |
|---|---|---|---|---|
| model | string | Bắt buộc | — | ID model DeepSeek V4. Ví dụ: "deepseek/deepseek-v4-flash". |
| messages | array | Bắt buộc | — | Lịch sử chat. Mỗi mục là { role, content }. role ∈ system | user | assistant | tool. |
| max_tokens | integer | Tùy chọn | upstream default | Số token đầu ra tối đa. Nếu không chỉ định, DeepSeek sẽ dùng mặc định của upstream (tối đa 384K). Ở chế độ thinking, bộ đếm BAO GỒM cả reasoning tokens — đừng đặt quá nhỏ. |
| temperature | number | Tùy chọn | 1.0 | Sampling temperature, 0.0–2.0. Càng thấp = càng xác định hơn. DeepSeek khuyến nghị 0.0 cho code, 1.3 cho viết sáng tạo. |
| top_p | number | Tùy chọn | 1.0 | Lấy mẫu nucleus. Chỉ dùng temperature HOẶC top_p, không dùng cả hai. |
| stream | boolean | Tùy chọn | false | Nếu true, sẽ trả về các delta theo Server-Sent Events (SSE). |
| thinking | object | Tùy chọn | {type:'enabled'} | Dành riêng cho DeepSeek. Truyền { type: 'disabled' } qua extra_body để bỏ qua giai đoạn suy luận, cho phản hồi nhanh hơn/rẻ hơn. Mặc định: enabled. |
| reasoning_effort | string | Tùy chọn | medium | Độ sâu suy nghĩ: low | medium | high. Càng cao = càng nhiều reasoning tokens, chất lượng tốt hơn, chi phí cao hơn. |
| tools | array | Tùy chọn | — | Danh sách các định nghĩa tool/function để dùng tool (function calling). |
| tool_choice | string|object | Tùy chọn | auto | Kiểm soát lựa chọn tool: auto | none | required | { type:'function', function:{ name } }. |
| response_format | object | Tùy chọn | — | Chế độ JSON: { "type": "json_object" } buộc model trả về JSON hợp lệ. |
curl https://tokenhub.store/api/v1/chat/completions \
-H "Authorization: Bearer th-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v4-flash",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain CAP theorem in 3 bullets."}
],
"temperature": 0.3
}'from openai import OpenAI
client = OpenAI(
api_key="th-your-api-key",
base_url="https://tokenhub.store/api/v1",
)
resp = client.chat.completions.create(
model="deepseek/deepseek-v4-flash",
temperature=0.3,
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain CAP theorem in 3 bullets."},
],
)
msg = resp.choices[0].message
# DeepSeek V4 returns the chain-of-thought in a separate field
print("Thinking:", getattr(msg, "reasoning_content", None))
print("Answer: ", msg.content)
print("Usage: ", resp.usage)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "th-your-api-key",
baseURL: "https://tokenhub.store/api/v1",
});
const resp = await client.chat.completions.create({
model: "deepseek/deepseek-v4-flash",
temperature: 0.3,
messages: [
{ role: "system", content: "You are a concise assistant." },
{ role: "user", content: "Explain CAP theorem in 3 bullets." },
],
});
const msg: any = resp.choices[0].message;
console.log("Thinking:", msg.reasoning_content);
console.log("Answer: ", msg.content);
console.log("Usage: ", resp.usage);DeepSeek V4 mở một giai đoạn suy luận riêng trước khi viết câu trả lời cuối cùng. Đây là những điều bạn cần biết:
Đăng ký TokenHub và bắt đầu gọi DeepSeek V4 qua API tương thích OpenAI của chúng tôi