Cloudflare Workers AI hosts the same DeepSeek Flash release as DeepSeek’s official API. Its published token prices match DeepSeek’s peak rates. The interesting wrinkle is that Cloudflare has a cheaper rate for fresh input through OpenRouter, while some other hosts charge substantially less for output. Which one saves you money depends on what you send, what the model generates, and how often your prompts hit the cache.
For the cheapest listed rates on the current release: Relace and OpenInference had the lowest uncached input price I found on OpenRouter ($0.035 per million), while Sail Research had the lowest output price ($0.15 per million). DeepInfra’s Flex promotion is a cheaper starting point for repeated prompts because its cache-read rate is lower than both. The table and worked example below show how to choose for your token mix.
Start with the model version
DeepSeek’s deepseek-flash alias currently serves DeepSeek V4.1 Flash 1017, the October 17, 2026 release. Third-party listings for DeepSeek-V4-Flash-0731 refer to the July release. Its prices can be useful if you’re flexible about the model, but they belong in a separate comparison. DeepSeek model names and pricing.
Compare the three token rates
These are listed inference rates in US dollars per million tokens, checked November 2, 2026. Credit-purchase fees are separate. DeepInfra’s figures include a temporary promotion. OpenRouter rates are a snapshot of its endpoint listings.
| Provider | Uncached input | Cached input | Output |
|---|---|---|---|
| DeepSeek direct, off-peak | $0.150 | $0.003 | $0.600 |
| DeepSeek direct, peak | $0.300 | $0.006 | $1.200 |
| Cloudflare Workers AI | $0.300 | $0.006 | $1.200 |
| Cloudflare via OpenRouter | $0.100 | $0.003 | $0.600 |
| DeepInfra standard promo | $0.098 | ≈$0.003 | $0.294 |
| DeepInfra Flex promo | $0.0784 | ≈$0.0024 | $0.2352 |
| Relace or OpenInference via OpenRouter (FP4) | $0.035 | $0.005 | $0.500 |
| Morph via OpenRouter (FP8) | $0.050 | $0.008 | $0.192 |
| Sail Research via OpenRouter (FP4) | $0.101 | $0.006735 | $0.150 |
| Together AI or Fireworks via OpenRouter | $0.300 | $0.006 | $1.200 |
DeepSeek charges peak rates from 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday through Friday, excluding Chinese public holidays. Everything outside those windows is off-peak. If a queue can wait, scheduling work outside peak hours cuts all three official token rates in half. DeepSeek peak and off-peak schedule.
Understand the three Cloudflare routes
- Workers AI direct. Cloudflare runs the model and publishes equivalent token and Neuron prices. The model requires Workers Paid or prepaid AI Gateway credits. Its token rates are twice DeepSeek’s off-peak rates across the board. Workers AI pricing and billing.
- Cloudflare via OpenRouter. The listed endpoint cuts uncached input from DeepSeek’s off-peak $0.15 to $0.10 per million. Output and cache reads match DeepSeek off-peak before OpenRouter’s Standard credit-purchase fee of 5.5%. A small top-up may incur a minimum fee. OpenRouter provider rates and OpenRouter fees.
- AI Gateway with your own DeepSeek key. Cloudflare proxies the call and DeepSeek bills the inference at its own rates. Cloudflare Unified Billing is a separate setup and adds a 5% fee when buying credits. DeepSeek integration and Unified Billing.
Send the same request to each API
Create a key with each provider you want to test, load it into the environment variable shown below, and keep it out of source control. These examples use curl and jq. For Workers AI, use a Cloudflare API token with Workers AI access and set CLOUDFLARE_ACCOUNT_ID. Each request has a 512-token output budget. Inspect the finish reason if the answer is empty or truncated, since reasoning can consume part of that budget.
DeepSeek direct
curl --fail-with-body -sS 'https://api.deepseek.com/chat/completions' \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek-flash",
"messages": [
{
"role": "user",
"content": "Explain why a warm prompt cache can reduce inference cost in two sentences."
}
],
"max_tokens": 512
}' | jq '{answer: .choices[0].message.content, finish_reason: .choices[0].finish_reason, usage, provider}'
Cloudflare Workers AI direct
curl --fail-with-body -sS "https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/ai/v1/chat/completions" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H 'Content-Type: application/json' \
--data '{
"model": "@cf/deepseek-ai/deepseek-v4.1-flash-1017",
"messages": [
{
"role": "user",
"content": "Explain why a warm prompt cache can reduce inference cost in two sentences."
}
],
"max_tokens": 512
}' | jq '{answer: .choices[0].message.content, finish_reason: .choices[0].finish_reason, usage, provider}'
Cloudflare through OpenRouter
Restrict the provider to Cloudflare and disable fallbacks so a successful request can be compared with the intended route. For a different host, look up its endpoint tag and change the provider filter. OpenRouter provider selection.
curl --fail-with-body -sS 'https://openrouter.ai/api/v1/chat/completions' \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek/deepseek-v4.1-flash-1017",
"messages": [
{
"role": "user",
"content": "Explain why a warm prompt cache can reduce inference cost in two sentences."
}
],
"max_tokens": 512,
"provider": {
"only": [
"cloudflare"
],
"allow_fallbacks": false
}
}' | jq '{answer: .choices[0].message.content, finish_reason: .choices[0].finish_reason, usage, provider}'
DeepInfra direct
curl --fail-with-body -sS 'https://api.deepinfra.com/v1/openai/chat/completions' \
-H "Authorization: Bearer $DEEPINFRA_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
"messages": [
{
"role": "user",
"content": "Explain why a warm prompt cache can reduce inference cost in two sentences."
}
],
"max_tokens": 512
}' | jq '{answer: .choices[0].message.content, finish_reason: .choices[0].finish_reason, usage, provider}'
Measure the cost of your workload
A smoke test checks the endpoint. A useful cost test replays representative prompts and measures cold and warm runs separately. For an agent, use the same stable system instructions and long prompt prefix across follow-up calls. Pin the OpenRouter provider while measuring so the cache has a chance to warm on the same backend. Record the actual cache hits and the provider that handled each call. OpenRouter prompt caching and routing.
Record prompt, cached prompt, and completion tokens from the usage response or provider billing logs. DeepSeek reports cache hits as prompt_cache_hit_tokens. OpenRouter reports them under prompt_tokens_details.cached_tokens. Use the provider’s reported completion total so any billed reasoning tokens are included. If a usage response omits a cache field, check the provider’s billing data before treating it as zero. DeepSeek response schema.
uncached_tokens = prompt_tokens - cached_tokens
cost_usd = (uncached_tokens * uncached_rate
+ cached_tokens * cached_rate
+ completion_tokens * output_rate) / 1_000_000
For example, take 100 million input tokens with 95% cache hits and one million output tokens. At the listed rates that’s about $1.64 on DeepSeek off-peak, $3.27 on Workers AI direct, $1.39 on Cloudflare via OpenRouter before fees, and $1.07 on DeepInfra standard during the promotion. This is a worked estimate with an identical cache-hit rate across providers. Actual results depend on cache behavior, token counts, and retries.
Choose which endpoint to test first
DeepInfra standard is a good first comparison against DeepSeek off-peak while the discount holds. It has a similar cache-read rate and charges roughly half as much for output. Relace or OpenInference is worth testing for fresh, input-heavy requests. Sail’s $0.15 output rate is attractive for workloads that generate a lot of text or reasoning. Its cache reads cost more than twice DeepSeek’s off-peak rate, which can erase the output savings on long sessions.
For coding and other tool-heavy workloads, compare successful task cost alongside token cost. A quantized endpoint that needs extra retries can cost more to finish the same job. Check tool-call validity, completion rate, latency, and cache hits on the same tasks before moving traffic. The figures here come from public price lists and endpoint metadata. They are pricing comparisons, with performance left for the workload test.
