{"id":4337,"date":"2026-08-16T03:56:44","date_gmt":"2026-08-16T03:56:44","guid":{"rendered":"https:\/\/tucumandevelopers.com\/index.php\/2026\/08\/16\/deepseek-now-prices-tokens-like-electricity-50-off-peak-discount-and-a-spring-boot-pattern-to-profit-from-it\/"},"modified":"2026-08-16T03:56:44","modified_gmt":"2026-08-16T03:56:44","slug":"deepseek-now-prices-tokens-like-electricity-50-off-peak-discount-and-a-spring-boot-pattern-to-profit-from-it","status":"publish","type":"post","link":"https:\/\/tucumandevelopers.com\/index.php\/2026\/08\/16\/deepseek-now-prices-tokens-like-electricity-50-off-peak-discount-and-a-spring-boot-pattern-to-profit-from-it\/","title":{"rendered":"DeepSeek Now Prices Tokens Like Electricity: 50% Off-Peak Discount and a Spring Boot Pattern to Profit From It"},"content":{"rendered":"<div>\n<div><\/div>\n<p>Then define the off-peak window exactly as DeepSeek defines it, in UTC: <\/p>\n<div>\n<pre><code><span>@Component<\/span> <span>public<\/span> <span>class<\/span> <span>OffPeakWindow<\/span> <span>{<\/span> <span>private<\/span> <span>static<\/span> <span>final<\/span> <span>ZoneId<\/span> <span>UTC<\/span> <span>=<\/span> <span>ZoneId<\/span><span>.<\/span><span>of<\/span><span>(<\/span><span>\"UTC\"<\/span><span>);<\/span> <span>public<\/span> <span>boolean<\/span> <span>isOffPeak<\/span><span>(<\/span><span>ZonedDateTime<\/span> <span>now<\/span><span>)<\/span> <span>{<\/span> <span>int<\/span> <span>hour<\/span> <span>=<\/span> <span>now<\/span><span>.<\/span><span>withZoneSameInstant<\/span><span>(<\/span><span>UTC<\/span><span>).<\/span><span>getHour<\/span><span>();<\/span> <span>\/\/ Peak: 01:00-04:00 and 06:00-10:00 UTC. Everything else is off-peak.<\/span> <span>return<\/span> <span>!((<\/span><span>hour<\/span> <span>&gt;=<\/span> <span>1<\/span> <span>&amp;&amp;<\/span> <span>hour<\/span> <span>&lt;<\/span> <span>4<\/span><span>)<\/span> <span>||<\/span> <span>(<\/span><span>hour<\/span> <span>&gt;=<\/span> <span>6<\/span> <span>&amp;&amp;<\/span> <span>hour<\/span> <span>&lt;<\/span> <span>10<\/span><span>));<\/span> <span>}<\/span> <span>}<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Now the batch job itself. The cron runs in UTC, so the schedule is stable regardless of where the server lives. 22:00 UTC is 04:00 in Dhaka, deep inside off-peak: <\/p>\n<div>\n<pre><code><span>@Component<\/span> <span>public<\/span> <span>class<\/span> <span>NightlyEmbeddingJob<\/span> <span>{<\/span> <span>private<\/span> <span>static<\/span> <span>final<\/span> <span>Logger<\/span> <span>log<\/span> <span>=<\/span> <span>LoggerFactory<\/span><span>.<\/span><span>getLogger<\/span><span>(<\/span><span>NightlyEmbeddingJob<\/span><span>.<\/span><span>class<\/span><span>);<\/span> <span>private<\/span> <span>final<\/span> <span>OffPeakWindow<\/span> <span>offPeakWindow<\/span><span>;<\/span> <span>private<\/span> <span>final<\/span> <span>ChatClient<\/span> <span>chatClient<\/span><span>;<\/span> <span>public<\/span> <span>NightlyEmbeddingJob<\/span><span>(<\/span><span>OffPeakWindow<\/span> <span>offPeakWindow<\/span><span>,<\/span> <span>ChatClient<\/span> <span>chatClient<\/span><span>)<\/span> <span>{<\/span> <span>this<\/span><span>.<\/span><span>offPeakWindow<\/span> <span>=<\/span> <span>offPeakWindow<\/span><span>;<\/span> <span>this<\/span><span>.<\/span><span>chatClient<\/span> <span>=<\/span> <span>chatClient<\/span><span>;<\/span> <span>}<\/span> <span>@Scheduled<\/span><span>(<\/span><span>cron<\/span> <span>=<\/span> <span>\"${ai.batch.cron}\"<\/span><span>,<\/span> <span>zone<\/span> <span>=<\/span> <span>\"UTC\"<\/span><span>)<\/span> <span>public<\/span> <span>void<\/span> <span>runBatch<\/span><span>()<\/span> <span>{<\/span> <span>if<\/span> <span>(!<\/span><span>offPeakWindow<\/span><span>.<\/span><span>isOffPeak<\/span><span>(<\/span><span>ZonedDateTime<\/span><span>.<\/span><span>now<\/span><span>()))<\/span> <span>{<\/span> <span>log<\/span><span>.<\/span><span>warn<\/span><span>(<\/span><span>\"Skipping batch run: peak hours in UTC\"<\/span><span>);<\/span> <span>return<\/span><span>;<\/span> <span>}<\/span> <span>\/\/ Heavy work: embeddings, summarization, eval runs.<\/span> <span>}<\/span> <span>}<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<div>\n<pre><code><span>ai.batch.cron<\/span><span>=<\/span><span>0 0 22 * * *<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>The window check is a safety net, not the primary control. The cron is the primary control, and the check exists for the day someone changes the cron to 08:00 UTC and forgets what that costs. Defensive, cheap, and it turns a pricing policy into code.<\/p>\n<p>The second piece is an estimator, because a cost problem you cannot see is a cost problem you will not fix. Model the official table as data: <\/p>\n<div>\n<pre><code><span>public<\/span> <span>record<\/span> <span>TokenPrice<\/span><span>(<\/span><span>double<\/span> <span>inputPerM<\/span><span>,<\/span> <span>double<\/span> <span>outputPerM<\/span><span>,<\/span> <span>double<\/span> <span>cacheHitPerM<\/span><span>)<\/span> <span>{}<\/span> <span>public<\/span> <span>final<\/span> <span>class<\/span> <span>DeepSeekRates<\/span> <span>{<\/span> <span>public<\/span> <span>static<\/span> <span>final<\/span> <span>TokenPrice<\/span> <span>FLASH_OFF_PEAK<\/span> <span>=<\/span> <span>new<\/span> <span>TokenPrice<\/span><span>(<\/span><span>0.22<\/span><span>,<\/span> <span>0.66<\/span><span>,<\/span> <span>0.007<\/span><span>);<\/span> <span>public<\/span> <span>static<\/span> <span>final<\/span> <span>TokenPrice<\/span> <span>FLASH_PEAK<\/span> <span>=<\/span> <span>new<\/span> <span>TokenPrice<\/span><span>(<\/span><span>0.44<\/span><span>,<\/span> <span>1.32<\/span><span>,<\/span> <span>0.014<\/span><span>);<\/span> <span>public<\/span> <span>static<\/span> <span>final<\/span> <span>TokenPrice<\/span> <span>PRO_OFF_PEAK<\/span> <span>=<\/span> <span>new<\/span> <span>TokenPrice<\/span><span>(<\/span><span>0.66<\/span><span>,<\/span> <span>1.98<\/span><span>,<\/span> <span>0.022<\/span><span>);<\/span> <span>public<\/span> <span>static<\/span> <span>final<\/span> <span>TokenPrice<\/span> <span>PRO_PEAK<\/span> <span>=<\/span> <span>new<\/span> <span>TokenPrice<\/span><span>(<\/span><span>1.32<\/span><span>,<\/span> <span>3.96<\/span><span>,<\/span> <span>0.044<\/span><span>);<\/span> <span>private<\/span> <span>DeepSeekRates<\/span><span>()<\/span> <span>{<\/span> <span>}<\/span> <span>}<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Then a component that picks the right tier by hour and logs an estimate after every call: <\/p>\n<div>\n<pre><code><span>@Component<\/span> <span>public<\/span> <span>class<\/span> <span>CostTracker<\/span> <span>{<\/span> <span>private<\/span> <span>final<\/span> <span>OffPeakWindow<\/span> <span>offPeakWindow<\/span><span>;<\/span> <span>public<\/span> <span>CostTracker<\/span><span>(<\/span><span>OffPeakWindow<\/span> <span>offPeakWindow<\/span><span>)<\/span> <span>{<\/span> <span>this<\/span><span>.<\/span><span>offPeakWindow<\/span> <span>=<\/span> <span>offPeakWindow<\/span><span>;<\/span> <span>}<\/span> <span>public<\/span> <span>void<\/span> <span>track<\/span><span>(<\/span><span>String<\/span> <span>model<\/span><span>,<\/span> <span>TokenPrice<\/span> <span>peak<\/span><span>,<\/span> <span>TokenPrice<\/span> <span>offPeak<\/span><span>,<\/span> <span>long<\/span> <span>cacheHitTokens<\/span><span>,<\/span> <span>long<\/span> <span>inputTokens<\/span><span>,<\/span> <span>long<\/span> <span>outputTokens<\/span><span>)<\/span> <span>{<\/span> <span>boolean<\/span> <span>offPeak<\/span> <span>=<\/span> <span>offPeakWindow<\/span><span>.<\/span><span>isOffPeak<\/span><span>(<\/span><span>ZonedDateTime<\/span><span>.<\/span><span>now<\/span><span>());<\/span> <span>TokenPrice<\/span> <span>price<\/span> <span>=<\/span> <span>offPeak<\/span> <span>?<\/span> <span>offPeak<\/span> <span>:<\/span> <span>peak<\/span><span>;<\/span> <span>double<\/span> <span>cost<\/span> <span>=<\/span> <span>(<\/span><span>cacheHitTokens<\/span> <span>\/<\/span> <span>1_000_000.0<\/span><span>)<\/span> <span>*<\/span> <span>price<\/span><span>.<\/span><span>cacheHitPerM<\/span><span>()<\/span> <span>+<\/span> <span>(<\/span><span>inputTokens<\/span> <span>\/<\/span> <span>1_000_000.0<\/span><span>)<\/span> <span>*<\/span> <span>price<\/span><span>.<\/span><span>inputPerM<\/span><span>()<\/span> <span>+<\/span> <span>(<\/span><span>outputTokens<\/span> <span>\/<\/span> <span>1_000_000.0<\/span><span>)<\/span> <span>*<\/span> <span>price<\/span><span>.<\/span><span>outputPerM<\/span><span>();<\/span> <span>log<\/span><span>.<\/span><span>info<\/span><span>(<\/span><span>\"{} {} cost estimate: ${} (tokens: {} cache hit \/ {} input \/ {} output)\"<\/span><span>,<\/span> <span>model<\/span><span>,<\/span> <span>offPeak<\/span> <span>?<\/span> <span>\"off-peak\"<\/span> <span>:<\/span> <span>\"peak\"<\/span><span>,<\/span> <span>cost<\/span><span>,<\/span> <span>cacheHitTokens<\/span><span>,<\/span> <span>inputTokens<\/span><span>,<\/span> <span>outputTokens<\/span><span>);<\/span> <span>}<\/span> <span>}<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Wire <code>track(...)<\/code> wherever you call the model, and after a week you have a distribution: what your workload costs at each hour. That distribution is the thing to optimize, because the off-peak discount only helps the workloads you actually move.<\/p>\n<h2> <a name=\"the-checklist-before-you-run-a-bill-through-it\" href=\"#the-checklist-before-you-run-a-bill-through-it\"> <\/a> The checklist before you run a bill through it <\/h2>\n<ul>\n<li> <strong>Move the cron-able work first.<\/strong> Embeddings, nightly evals, digest generation. These are pure savings: same output, half the price.<\/li>\n<li> <strong>Instrument cache-hit ratio.<\/strong> If 80% of your input tokens are cache hits, the new cache-hit price is your real price. Log it per request and per session.<\/li>\n<li> <strong>Set the window in UTC, not server-local time.<\/strong> A server in Dhaka and a server in Frankfurt must agree on what &#8220;off-peak&#8221; means. <code>zone = \"UTC\"<\/code> on <code>@Scheduled<\/code> keeps the schedule honest.<\/li>\n<li> <strong>Re-check OpenRouter and other resellers.<\/strong> DeepSeek&#8217;s first-party pricing changed, but the same open-weight models are still sold by other providers at older rates. A one-line base-URL change in Spring AI is your cheapest mitigation.<\/li>\n<li> <strong>Re-run your cost estimates after August 16.<\/strong> The old flat-rate math is dead. If your spreadsheets still say $0.435 for V4 Pro input, they are wrong twice: the price moved, and it now depends on the hour.<\/li>\n<\/ul>\n<h2> <a name=\"what-i-would-do-differently\" href=\"#what-i-would-do-differently\"> <\/a> What I would do differently <\/h2>\n<p>The lesson here is not &#8220;DeepSeek raised prices.&#8221; Every frontier provider will eventually do time-of-day or tiered pricing, because demand is diurnal and infrastructure is expensive to idle. The lesson is that model cost stopped being a constant, and my code was written as if it was.<\/p>\n<p>I have been building production AI systems with Spring Boot and Spring AI for over a year, and the first time I integrated a frontier model I hardcoded a price per million tokens in a constants file. That file is now a time function. The fix is not cleverer math, it is treating pricing like configuration: a table, a UTC clock, and a log line that makes the cost visible per call. When the next provider copies DeepSeek&#8217;s playbook, you change the table, not the architecture.<\/p>\n<p><strong>Have you checked what your DeepSeek bill would look like under the new peak and off-peak rates? What workload are you planning to move into the off-peak window? I read every response.<\/strong><\/p>\n<p>I write about Java, Spring Boot, and AI every week. Subscribe, it&#8217;s free.<\/p>\n<p><strong>Bookmark this one.<\/strong> The next time a model provider announces a discount, your first question should not be &#8220;how much off?&#8221; It should be &#8220;off what baseline, and at what hour?&#8221;<\/p>\n<\/p><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Fuente: <a href=\"https:\/\/dev.to\/jamilxt\/deepseek-now-prices-tokens-like-electricity-50-off-peak-discount-and-a-spring-boot-pattern-to-1j7g\">Art\u00edculo original<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Then define the off-peak window exactly as DeepSeek defines it, in UTC: @Component public class OffPeakWindow { private static final ZoneId UTC = ZoneId.of(&#8220;UTC&#8221;); public boolean isOffPeak(ZonedDateTime now) { int hour = now.withZoneSameInstant(UTC).getHour(); \/\/ Peak: 01:00-04:00 and 06:00-10:00 UTC. Everything else is off-peak. return !((hour &gt;= 1 &amp;&amp; hour &lt; 4) || (hour &gt;= 6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4336,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"webixso_pending_account_ids":""},"categories":[41],"tags":[],"class_list":["post-4337","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devto"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts\/4337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/comments?post=4337"}],"version-history":[{"count":0,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts\/4337\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/media\/4336"}],"wp:attachment":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/media?parent=4337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/categories?post=4337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/tags?post=4337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}