LLM · Vision
DeepSeek V4.1 Flash API, free to try
No credit card · Free credits valid for 30 days · Then top up and pay as you go, no subscription
DeepSeek V4.1 Flash
LLM · Vision
model: "deepseek-v4.1-flash:economy"
reasoning_effort: "high"
system: You are a senior Python engineer. Explain in two sentences, then give the fixed function.
user
Why does this print [1] and then [1, 2]?
def add(x, items=[]):
items.append(x)
return items
print(add(1))
print(add(2))
assistant
reasoning_content · 113 tokens
The default list [] is created once when the function is defined and reused across calls, so the second call modifies the same list returned by the first call. That’s why it prints [1] and then [1, 2].
def add(x, items=None):
if items is None:
items = []
items.append(x)
return items
DeepSeek V4.1 Flash use cases
Response: message.content
{
"invoice_number": "NS-2026-0418",
"issue_date": "2026-11-03",
"due_date": "2026-11-17",
"seller": "Nordlicht Studio GmbH",
"seller_vat_id": "DE298765431",
"net": 2250.00,
"vat": 427.50,
"total": 2677.50,
"currency": "EUR",
"iban": "DE44 1001 0010 0123 4567 89"
}
DeepSeek V4.1 Flash API pricing
| Tokens | Price per 1M | For $5 |
|---|---|---|
| Input (text and images) | $0.132 | ≈ 37M tokens |
| Cached input (repeated prompt prefix) | $0.0026 | ≈ 1,923M tokens |
| Output (answer and reasoning) | $0.528 | ≈ 9.4M tokens |
| Question in the hero, one call | $0.00012 | ≈ 42,000 calls |
| Invoice example, one call | $0.00029 | ≈ 17,000 calls |
DeepSeek V4.1 Flash vs Qwen3.8 Flash vs Kimi K3
| DeepSeek V4.1 Flash | Qwen3.8 Flash | Kimi K3 | |
|---|---|---|---|
| Input | Text, image | Text, image | Text, image |
| Context | 1,048,576 tokens | 1,000,000 tokens | 1,000,000 tokens |
| Max output | 393,216 tokens | 131,072 tokens | 131,072 tokens |
reasoning_effort |
none to max, 7 levels | none to max, 7 levels | none to max, 7 levels |
| Invoice example: input tokens | 782 | 1,108 | 1,426 |
| Invoice example: fields correct | 10 of 10 | 10 of 10 | 10 of 10 (IBAN without spaces) |
| Price per 1M, input / output | $0.132 / $0.528 | $0.165 / $0.517 | $3.30 / $16.50 |
DeepSeek V4.1 Flash API example
- Model ID
- Endpoint
- Input
- Context and output
- Reasoning
- Output options
curl https://oai.deapi.ai/v1/chat/completions \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "deepseek-v4.1-flash:economy",
"reasoning_effort": "low",
"messages": [
{"role": "system", "content": "Sort support tickets. Reply with one word: billing, bug, feature or other."},
{"role": "user", "content": "I was charged twice for the November top-up."}
]
}'
import base64, json
from openai import OpenAI
client = OpenAI(base_url="https://oai.deapi.ai/v1", api_key="YOUR_API_KEY")
with open("invoice.png", "rb") as f:
image = "data:image/png;base64," + base64.b64encode(f.read()).decode()
schema = {
"type": "object",
"additionalProperties": False,
"required": ["invoice_number", "issue_date", "due_date", "seller",
"seller_vat_id", "net", "vat", "total", "currency", "iban"],
"properties": {
"invoice_number": {"type": "string"},
"issue_date": {"type": "string"},
"due_date": {"type": "string"},
"seller": {"type": "string"},
"seller_vat_id": {"type": "string"},
"net": {"type": "number"},
"vat": {"type": "number"},
"total": {"type": "number"},
"currency": {"type": "string"},
"iban": {"type": "string"},
},
}
response = client.chat.completions.create(
model="deepseek-v4.1-flash:economy",
temperature=0,
messages=[
{"role": "system", "content": "Extract invoice fields. "
"Dates as YYYY-MM-DD, amounts as numbers."},
{"role": "user", "content": [
{"type": "text", "text": "Extract the fields from this invoice."},
{"type": "image_url", "image_url": {"url": image}},
]},
],
response_format={"type": "json_schema",
"json_schema": {"name": "invoice", "strict": True, "schema": schema}},
)
invoice = json.loads(response.choices[0].message.content)
print(invoice["total"], invoice["currency"]) # 2677.5 EUR
print(response.usage)
What is DeepSeek V4.1 Flash?
-
Create a free account
-
Point your client at deAPI
-
Send the request
DeepSeek V4.1 Flash FAQ
Send your first DeepSeek V4.1 Flash request with $5 of free credits
Sign up with e-mail or Google. No subscription, pay as you go.