Operator guide
How to Build a Reliable DeepSeek API V4 Stack: Vision, Pricing & Scaling
How to scale DeepSeek API V4 the reliable way: August 2026 pricing, vision image methods, token limits, concurrency, and user_id isolation for production.
August 25, 2026·14 min read·OmniKit Editorial
DeepSeek August 2026 peak vs off-peak schedule
Starting Sunday, August 23, 2026, at 00:00 Beijing Time, weekends use off-peak pricing all day. Monday–Friday peak hours are 01:00–04:00 UTC and 06:00–10:00 UTC; all other weekday hours are off-peak. Off-peak pricing is 50% of the peak rate.
- Effective
- Sunday, 23 August 2026, 00:00 Beijing Time
- Weekend
- Off-peak pricing all day
- Weekday peak (UTC)
- 01:00–04:00 and 06:00–10:00
- Off-peak rate
- 50% of peak
- Date checked
- 25 August 2026
- Source
- This OmniKit operator guide; verify on DeepSeek billing docs
DeepSeek V4 list prices per 1M tokens (peak / off-peak)
V4-Flash and Vision-Exp share cache-hit, cache-miss, and output rates. V4-Pro is higher across the board. Prices below are per 1 million tokens; off-peak is half of peak.
- V4-Flash / Vision-Exp cache hit
- Off-peak $0.007 · Peak $0.014
- V4-Flash / Vision-Exp cache miss
- Off-peak $0.22 · Peak $0.44
- V4-Flash / Vision-Exp output
- Off-peak $0.66 · Peak $1.32
- V4-Pro cache hit
- Off-peak $0.022 · Peak $0.044
- V4-Pro cache miss
- Off-peak $0.66 · Peak $1.32
- V4-Pro output
- Off-peak $1.98 · Peak $3.96
- Unit
- USD per 1,000,000 tokens
DeepSeek V4 account concurrency ceilings
DeepSeek applies concurrency limits at the account level. A connection counts from request send until the final response byte. Exceeding the limit can return HTTP 429 Too Many Requests.
- deepseek-v4-pro
- 500 concurrent connections
- deepseek-v4-flash
- 2,500 concurrent connections
- deepseek-v4-flash-vision-exp
- 2,500 concurrent connections
- Over limit
- HTTP 429 — retry with exponential backoff
DeepSeek vision capacity limits
Treat these as application-level constraints and reject invalid payloads before they reach the API. Images belong only in user messages; text-only models reject images with a 400.
- External URL length
- max 8,192 characters
- Request body
- max 48 MiB
- Image via Base64/URL
- max 32 MiB
- Image via Files API
- max 64 MiB
- Images per request
- max 600
- Payload without file IDs
- max 64 MiB
- Payload with file IDs
- max 200 MiB
- Max dimension
- 8,192 px/side (4,096 if ≥15 images)
If you're building on the DeepSeek API, your integration needs to be reliable from the start. Poor image handling, ignored rate limits, and inefficient token usage can quickly turn into broken requests and unnecessary costs.
This guide covers the practical architecture behind the DeepSeek V4 ecosystem, including the deepseek-v4-flash-vision-exp model, the August 2026 pricing changes, image processing, API limits, and concurrency management.
If your current implementation ignores these constraints, it's worth fixing now rather than waiting for production traffic to expose the problems.
August 2026 Pricing Changes
Starting Sunday, August 23, 2026, at 00:00 Beijing Time, DeepSeek changed its billing schedule.
The main change is straightforward: weekends now use off-peak pricing all day.
From Monday through Friday, peak hours are:
- 01:00–04:00 UTC
- 06:00–10:00 UTC
All other weekday hours are off-peak. Off-peak pricing is 50% of the peak rate.
Core Model Pricing
| Model & Token Type | Off-Peak | Peak |
|---|---|---|
| V4-Flash & Vision-Exp — Cache Hit | $0.007 | $0.014 |
| V4-Flash & Vision-Exp — Cache Miss | $0.22 | $0.44 |
| V4-Flash & Vision-Exp — Output | $0.66 | $1.32 |
| V4-Pro — Cache Hit | $0.022 | $0.044 |
| V4-Pro — Cache Miss | $0.66 | $1.32 |
| V4-Pro — Output | $1.98 | $3.96 |
All prices are per 1 million tokens.
What this means for architecture
Cache utilization matters. For V4-Pro, a cache miss costs dramatically more than a cache hit, so prompts should be structured with KVCache reuse in mind.
If you have large batch workloads that don't need immediate processing, weekends and weekday off-peak periods are the obvious windows to consider.
Deductions are taken from your granted balance first, followed by your topped-up balance.
Vision Integration: deepseek-v4-flash-vision-exp
The deepseek-v4-flash-vision-exp model supports multimodal workloads such as screenshot analysis, chart interpretation, and other image-based tasks.
Supported image formats include:
- JPEG
- PNG
- GIF
- WebP
The API does not simply trust the file extension. Image formats are detected using the MIME payload information and the underlying file bytes.
There are three primary ways to provide an image.
Method A: Base64-Encoded Images
Base64 is useful when you're working with local images or relatively small files.
The image is encoded and sent as a data URL.
The main drawback is request size. Base64 increases the data size by roughly 33%, and the request body is limited to 48 MiB.
For large images, this can become a problem quickly.
import base64
from openai import OpenAI
client = OpenAI(
api_key="<KEY>",
base_url="https://api.deepseek.com"
)
with open("image.jpg", "rb") as f:
b64 = base64.b64encode(f.read()).decode("utf-8")
response = client.chat.completions.create(
model="deepseek-v4-flash-vision-exp",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this."},
{
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{b64}"
}
}
]
}
]
)For small, local operations, this approach is simple. For larger production workloads, however, the request-size overhead makes other approaches more attractive.
Method B: External Image URL
You can also provide a publicly accessible HTTP or HTTPS URL.
DeepSeek downloads the image from that URL before processing it.
There are several constraints:
- URL length: maximum 8,192 characters
- Image size: under 32 MiB
- Download timeout: 60 seconds
This works well when your images are already hosted on a reliable CDN.
If your origin server is slow or unreliable, however, the 60-second download limit can become a failure point.
Method C: Files API
For applications that repeatedly analyze larger images, the Files API is generally the cleaner production approach.
Instead of sending the image with every request, upload it once and reference the resulting file_id.
This keeps individual requests smaller and allows images up to 64 MiB.
The request can reference the uploaded file like this:
"content": [
{"type": "text", "text": "Analyze this cache."},
{"type": "file", "file_id": "file-api-xxxxxxxxxxxxxxxx"}
]For systems that process large or frequently reused images, this approach avoids unnecessary network transfers and makes request handling easier to manage.
Image Token Usage and Resolution
Image costs are based on tokens rather than raw file size.
That means a 4K image isn't necessarily more expensive simply because the source file contains more pixels. DeepSeek processes the image according to its dimensions and applies its own scaling rules before inference.
Image scaling
The processing roughly follows these rules:
- Images below approximately 384×384 are scaled up while preserving their aspect ratio.
- Larger images are scaled down while preserving their aspect ratio.
- The effective image area is capped around an 800×800 footprint.
- The resulting processing has an upper limit of approximately 384 image tokens per image.
So, for example, a 1080p image and a much larger 5000×5000 image can end up with the same token cost after the API applies its scaling.
Because of this, manually shrinking a large image to 800×800 solely to reduce token usage may not provide the benefit you expect.
The detail parameter
When using an image_url, the detail setting lets you control how the image is processed.
low — The image is reduced to approximately 512×512 before inference. This is useful for straightforward classification or situations where fine visual details aren't important. It can also reduce processing time and cost.
high, original, or auto — These modes preserve the original aspect ratio and use the standard image-scaling process.
The right setting depends on how much visual detail your application actually needs.
System Limits and Restrictions
These limits should be treated as application-level constraints, not something you discover after a production request fails.
Build validation into your application so oversized or invalid requests are rejected before they reach the API.
Capacity limits
- Maximum external URL length: 8,192 characters
- Maximum request body size: 48 MiB
- Maximum individual image size through Base64/URL: 32 MiB
- Maximum individual image size through the Files API: 64 MiB
- Maximum images per request: 600
- Maximum total payload without file IDs: 64 MiB
- Maximum total payload with file IDs: 200 MiB
- Maximum image dimension: 8,192 px per side
- If a request contains 15 or more images, the maximum dimension drops to 4,096 px per side
Protocol restrictions
Images can only be included in user messages. Putting images inside system or assistant messages results in a 400 error.
Likewise, sending images to a text-only model such as deepseek-v4-pro will fail.
Don't manually insert the API's reserved image placeholder token into your text. Let the API construct the appropriate representation from the image content block.
Cross-Platform API Compatibility
DeepSeek supports API patterns compatible with both OpenAI and Anthropic architectures, but the payload structures aren't interchangeable.
Anthropic-compatible API
The Anthropic endpoint uses an image block with a source object rather than OpenAI's image_url structure.
For Base64 images, you need to specify the media type explicitly, such as:
- image/jpeg
- image/png
When using the Files API, the file_id belongs under source.type = "file".
You also need to send the following header:
anthropic-beta: files-api-2025-04-14Missing that header can cause the request to fail.
Responses API
The Responses API is intended for more complex workflows involving tools and function outputs.
The image concept is similar, but the JSON structure changes. Instead of image_url, the request uses input_image within user/developer messages or custom tool outputs.
One important detail: when a file_id is used, the detail parameter is ignored.
Concurrency, Isolation, and Connection Stability
Production systems need more than a working API call. They also need sensible concurrency control and isolation between users.
DeepSeek applies concurrency limits at the account level.
Base concurrency limits
| Model | Concurrent Connections |
|---|---|
| deepseek-v4-pro | 500 |
| deepseek-v4-flash | 2,500 |
| deepseek-v4-flash-vision-exp | 2,500 |
A connection counts toward the limit from the moment the request is sent until the final response byte is received.
If you exceed the limit, the API can return:
HTTP 429 Too Many RequestsYour application should handle this gracefully using retry logic with exponential backoff.
A production system that simply crashes whenever it receives a 429 has a concurrency problem, not just an API problem.
The user_id Parameter
For B2B SaaS and other multi-user applications, each end user should have a distinct user_id.
Don't funnel every customer through one generic identifier.
A user-specific ID helps DeepSeek isolate:
- Content-safety behavior
- KVCache handling
- Scheduling and prompt-queue behavior
The user_id must match:
[a-zA-Z0-9\-_]+and cannot exceed 512 characters.
Don't send personally identifiable information such as email addresses, names, or Social Security numbers in this field. Use a stable internal identifier or a hashed representation instead.
Keep-Alive and Long-Running Requests
Inference can take time, particularly for more demanding workloads.
To keep connections alive while processing is underway, DeepSeek uses periodic keep-alive signals.
For non-streaming requests, the server may return empty lines periodically.
For streaming requests, keep-alive comments can appear as:
: keep-aliveYour parser needs to tolerate these messages.
If your JSON parser assumes that every incoming line is a JSON object, it can break when a heartbeat arrives.
Also account for the server's 10-minute window: if inference hasn't started within that period, the connection can be closed.
Final Takeaway
A reliable DeepSeek integration isn't just about sending the correct JSON. The surrounding architecture matters just as much.
The important pieces are:
- Design prompts for cache reuse.
- Use off-peak periods for workloads that don't require immediate execution.
- Use Base64 for small, local images rather than large production payloads.
- Use external URLs when your images are already reliably hosted.
- Use the Files API for larger or repeatedly processed images.
- Validate image and request limits before making API calls.
- Implement exponential backoff for 429 responses.
- Use distinct, non-PII user_id values in multi-tenant applications.
- Make your streaming and non-streaming parsers tolerant of keep-alive messages.
- Treat the API limits as part of your architecture, not as edge cases.
The models are capable, but they aren't forgiving of sloppy integrations. Get the payload structure, image handling, caching, concurrency, and error handling right before scaling traffic.
Frequently asked questions
When did DeepSeek’s August 2026 pricing change take effect?
Starting Sunday, August 23, 2026, at 00:00 Beijing Time. Weekends now use off-peak pricing all day. Weekday peak hours are 01:00–04:00 UTC and 06:00–10:00 UTC; off-peak is 50% of the peak rate.
What is deepseek-v4-flash-vision-exp used for?
It is DeepSeek’s multimodal V4 Flash vision model for workloads such as screenshot analysis, chart interpretation, and other image-based tasks. Supported formats include JPEG, PNG, GIF, and WebP.
Should I send DeepSeek vision images as Base64, URL, or Files API?
Use Base64 for small local images (request body max 48 MiB, ~33% size overhead). Use a public HTTP/HTTPS URL when images are on a reliable CDN (under 32 MiB, 60s download). Use the Files API for larger or reused images (up to 64 MiB) by uploading once and referencing file_id.
Do larger source images always cost more DeepSeek image tokens?
No. Image cost is token-based after DeepSeek’s scaling rules. Effective area is capped around an 800×800 footprint with roughly up to 384 image tokens per image, so a 1080p image and a 5000×5000 image can land at the same token cost.
What concurrency limits does DeepSeek V4 apply?
Account-level ceilings: 500 concurrent connections for deepseek-v4-pro, and 2,500 for deepseek-v4-flash and deepseek-v4-flash-vision-exp. Over the limit, expect HTTP 429 and retry with exponential backoff.
How should SaaS apps set DeepSeek user_id?
Give each end user a distinct non-PII identifier matching [a-zA-Z0-9\-_]+ up to 512 characters. Do not send emails, names, or SSNs. Distinct IDs help isolate content-safety, KVCache, and scheduling behavior.