# Changelog

## 1.3.4 (2026-09-10)

- Fix silently wrong costs on V4.1 Flash: the API now reports `responseModel: "deepseek-flash"` for every request (including `deepseek-v4-flash`), and that id was missing from the rate table — `message_end` and `/dsp-cost` fell back to pi's bundled flat rate ($0.14/$0.28/$0.0028 per 1M). `deepseek-flash` is now priced at the V4.1 flash table ($0.30/$0.006/$1.20 at peak, half off-peak)
- Resolve the rate from the id the API reported (`responseModel`) and fall back to the requested id instead of discarding the message when the reported id is unknown
- V4 Pro is routed to V4.1 Flash server-side: from 2026-09-14 12:00 Beijing (= 04:00 UTC) `deepseek-v4-pro` messages are billed at the flash table. `/dsp-cost` shows `pro ... (routed to flash)` from that instant
- `/dsp-cost` lists the unknown model ids when a message keeps pi's bundled cost (`N message(s) without a rate entry (id1, id2) — kept at pi's bundled cost`)
- README: how pi's bundled catalogue lacks `deepseek-flash`, and a `~/.pi/agent/models.json` snippet to add it (needed for vision under the V4.1 id)

## 1.3.3 (2026-09-09)

- Flash series price cut (effective 2026-09-10 12:00 Beijing = 04:00 UTC): `deepseek-v4-flash` and `deepseek-v4-flash-vision-exp` messages completing at/after the cutover are priced at the new rates — $0.30 input / $0.006 cache hit / $1.20 output per 1M tokens at peak (half off-peak); messages before it keep the old $0.44 / $0.014 / $1.32 table
- `/dsp-cost` and the stored-cost patch price each message with the table in effect at its completion time, so resumed sessions stay correct across the cutover; pro rates and the peak/off-peak windows are unchanged

## 1.3.2 (2026-08-27)

- `/dsp-refresh`: pick the status auto-refresh interval from a menu — 30s, 1m or 5m (default 5m, unchanged). Saved to `~/.pi/agent/deepseek-peak.json` (`refresh`, in seconds) and applied immediately; the countdown refreshes at the same interval
- `/dsp-countdown` now picks on/off from a menu (no argument needed), mirroring `/dsp-refresh`
- `/dsp-offset` removed: the windows are UTC, so the offset field is dropped from the config
- Correct DeepSeek session pricing: each DeepSeek V4 assistant reply's stored `usage.cost` is patched at `message_end` with the rate in effect when the request completed (peak/off-peak, per model) — pi's footer and `/session` cost totals now reflect the real price
- Add `/dsp-cost`: recomputes the whole session (peak/off-peak split, per-model tokens and cost) from stored messages, correct for sessions resumed from disk; nested tool usage and compaction summaries are attributed to the nearest preceding assistant message
- Add DeepSeek V4 rate table (flash $0.44/$0.014/$1.32, pro $1.32/$0.044/$3.96 per 1M tokens; off-peak = exactly half); legacy `deepseek-chat`/`deepseek-reasoner` messages keep pi's bundled cost
- Selfcheck now covers `requestCost`/`sessionCost` (`npm test`)

## 1.3.1 (2026-08-25)

- Countdown next to the status dot is now on by default (`/dsp-countdown off` to disable); existing configs with `countdown: false` are respected
- Fix crash on session replacement or `/reload`: status timer no longer holds a stale extension ctx (crash reported in #1)
- Timer now tracks the current session's ctx (refreshed on `session_start`, cleared on `session_shutdown`) and stops itself if the ctx ever goes stale

## 1.3.0 (2026-08-24)

- Off-peak all day on weekends (Saturdays/Sundays, Beijing time), per DeepSeek's updated billing rules (effective 2026-08-23)
- Peak windows now match DeepSeek's published rule exactly: Mon-Fri 01:00-04:00 and 06:00-10:00 UTC; `/dsp-offset` no longer shifts the windows (kept for compatibility)
- Add `/dsp-countdown on|off` option: shows the time until the next price change next to the status dot ("DS Peak for 1h30m", "DS Normal for 27h"), refreshed with the 5-minute status check
- Add `scripts/selfcheck.ts` for the peak/countdown logic (`npm test`)

## 1.2.0 (2026-07-28)

- Switch install to `pi install npm:pi-deepseek-peak`
- Add screenshot preview for pi.dev gallery

## 1.1.1 (2025-07-25)

- Fix export format: default export is now the factory function directly (not wrapped in an object)
- Resolves `"Extension does not export a valid factory function"` error

## 1.1.0 (2025-07-25)

- Add `/dsp-offset` command to configure UTC offset
- Persist offset to `~/.pi/agent/deepseek-peak.json`
- Default UTC+2

## 1.0.0 (2025-07-25)

- Initial release
- Status bar indicator for DeepSeek peak hours (UTC)
- Auto-refresh every 5 minutes
