Skip to content

DeepSeek V4 is time-of-day priced: peak calls under-reported 2x (pricing.ts pins off-peak) #89

Closed

Description

@zarguell

DeepSeek V4 peak/off-peak pricing not modeled — peak calls under-reported 2x

Provider version: 0.6.4
Models affected: deepseek/deepseek-v4-pro, deepseek/deepseek-v4-flash,
deepseek/deepseek-v4-flash-vision-exp (deepseek/deepseek-v4-flash-fast is
fixed-rate and unaffected)

Bug

DeepSeek V4 charges by time of day. Per
commandcode.ai/docs/resources/pricing-limits:

  • Off-peak (17h/day): the list rates currently in src/pricing.ts.
  • Peak = 2x, Mon-Fri 01:00-04:00 and 06:00-10:00 UTC.
  • Weekends are entirely off-peak, regardless of hour.

src/pricing.ts hardcodes the off-peak numbers (its own comment says so) and
calculateCommandCodeCost has no access to the request timestamp, so every
peak call is billed at half its real cost
in local usage.cost.

model off-peak in/out (cached) peak in/out (cached)
deepseek/deepseek-v4-pro $0.66 / $1.98 / $0.022 $1.32 / $3.96 / $0.044
deepseek/deepseek-v4-flash $0.22 / $0.66 / $0.007 $0.44 / $1.32 / $0.014
deepseek/deepseek-v4-flash-vision-exp $0.22 / $0.66 / $0.007 $0.44 / $1.32 / $0.014

(cache-read peak derived as the same 2x ratio; input/output are documented.)

Evidence

Across 99 consecutive deepseek/deepseek-v4-flash calls recorded in
~/.pi/agent/usage.jsonl, every one landed inside a peak window
(03:13-03:24 UTC on a Thursday) and every recorded usage.cost matched the
off-peak rate to within 1e-9. Repricing with the peak multiplier gives
exactly 2.00x ($0.1495 provider-reported -> $0.2991), which is what the
usage page bills.

Suggested fix

Make the rate lookup time-aware for the DeepSeek V4 family, e.g. extend
CommandCodeModelCost with optional peak windows (or a rateFor(model, at)
helper in pricing.ts) and call it from calculateCommandCodeCost using
Date.now(). The existing tiers mechanism is context-length based, so it
does not cover this.

A cheaper stop-gap: document that DeepSeek V4 local cost is off-peak-only, but
that still silently under-reports 7 hours a day.

Activity

  1. patlux commented on Sep 15, 2026

    @patlux
    Owner

    Thanks for the thorough analysis! Version 0.7.0 updates the base rates, but it does not add time-aware peak pricing, so this issue remains open. The displayed costs currently use the documented off-peak rates.

    If you’d like to contribute a fix, a focused PR would be very welcome. This could be a good task to work through with an AI coding assistant: start with deterministic tests for the UTC window boundaries and weekends, then wire the rate selection into the relevant cost-calculation paths.

    Please use the current official rates, as some have changed since this report, and cover both Pi and OMP behavior where applicable. Your existing investigation is a great starting point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions