omp packages

pi-deepseek-hours0.2.0

DeepSeek peak/off-peak hours footer indicator for the Pi coding agent: colored badge showing the current billing window with a live countdown to the next transition, per DeepSeek's official pricing schedule.

GitHub Actions Published 17 days ago MIT ~363 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-deepseek-hours

DeepSeek peak/off-peak billing hours footer indicator for the Pi coding agent.

Shows whether DeepSeek API usage is currently billed at the peak rate or the off-peak rate (50% off), with a live countdown to the next transition. The schedule comes straight from DeepSeek's official pricing docs:

"Off-peak rates are half of the peak rates. Peak hours are 01:00 - 04:00 and 06:00 - 10:00 UTC, Monday through Friday (all other hours are off-peak)." — https://api-docs.deepseek.com/quick_start/pricing

Rate card (Flash series) — effective 12:00 Beijing time, 2026-09-10, off-peak unit prices are $0.003 / 1M input tokens (cache hits), $0.15 / 1M input tokens (cache misses) and $0.6 / 1M output tokens; peak-hour prices are double the off-peak rates. The peak/off-peak schedule above is unchanged.

Install

# install from npm
pi install npm:pi-deepseek-hours

# or copy the single file into your global extensions dir
cp src/deepseek-hours.ts ~/.pi/agent/extensions/

Then /reload (or restart).

Usage

The indicator appears in the footer only while a DeepSeek model is the active provider (provider id deepseek). Switch models and it follows automatically.

Command Effect
/deepseek-hours Toggle the badge on/off (persisted)
/deepseek-hours badge Colored status in the built-in footer (default)
/deepseek-hours full Deprecated alias for badge; the built-in footer already shows other extensions' statuses next to the badge
/deepseek-hours off No indicator
/deepseek-hours status Print the current window state as plain text, plus the Flash rate card (e.g. for a quick check or to share with the model)
/deepseek-hours mode Show the current mode (persisted or default)
/deepseek-hours mode badge|full|off Set the mode and persist it across restarts
/deepseek-hours mode reset Back to the default (badge), clears persistence

The mode set via any command above is persisted to ~/.pi/agent/deepseek-hours/mode.json and re-applied on the next session start (/reload included), so the choice survives restarts. full is still accepted and a persisted full still loads, but it always renders as badge (selecting it keeps writing full to the state file). The badge appears in the built-in footer — including Pi 1.0's fullscreen footer dock — alongside other extensions' statuses, so the old custom-footer mode is no longer needed.

What it shows

  • OFF-PEAK (green): DSK off-peak (-50%) · next peak 01:00 UTC in 42m
  • PEAK (amber): DSK peak (2× off-peak) · off-peak 10:00 UTC in 3h 12m
  • Weekend: DSK off-peak (-50%) · next peak Mon 01:00 UTC in 1d

/deepseek-hours status appends the current rate card, with peak prices derived (2× off-peak) in code:

DeepSeek PEAK (2× off-peak rate) · next off-peak 04:00 UTC in 2h · now 02:00 UTC (Mon) · Flash (per 1M tokens): off-peak $0.003 / $0.15 / $0.6 · peak $0.006 / $0.3 / $1.2
  • Non-UTC schedules are labeled local instead of UTC; transitions on a later day are prefixed with the weekday.

The countdown refreshes every 30 seconds; the badge only updates when its text actually changes.

Configuration (optional env vars)

The official schedule is hardcoded by default; everything is overridable for schedule changes and testing:

Env var Meaning Default
DEEPSEEK_PEAK_WINDOWS Comma-separated HH:MM-HH:MM peak windows in the schedule timezone 01:00-04:00,06:00-10:00
DEEPSEEK_UTC_OFFSET Hours added to UTC for the schedule timezone (e.g. 8 for Beijing) 0 (official schedule is UTC)
DEEPSEEK_PROVIDER_IDS Comma-separated provider ids to match deepseek
DEEPSEEK_FLASH_RATES Off-peak Flash unit prices, USD per 1M tokens, as hit,miss,output (peak prices are derived as 2× off-peak) 0.003,0.15,0.6
DEEPSEEK_HOURS_STATE Mode state file (where /deepseek-hours mode persists) ~/.pi/agent/deepseek-hours/mode.json

Example (Beijing-time schedule):

export DEEPSEEK_UTC_OFFSET=8

If DeepSeek ever changes the windows (or you want to simulate), just set the vars and /reload:

export DEEPSEEK_PEAK_WINDOWS="09:00-12:00,14:00-18:00"   # Beijing peak hours

Invalid values are ignored with a warning — the extension falls back to the defaults and never breaks pi.

How it works

  • ctx.ui.setStatus("deepseek-hours", ...) renders the colored badge inside the built-in footer (ANSI colors are honored).
  • A 30-second timer recomputes the state; renders only happen when the displayed text changes.
  • The provider is detected via ctx.model.provider on model_select / session_start / agent_end events.
  • The indicator auto-clears on session_shutdown.

Development / tests

The extension is a single file — no build step. Install the pinned development dependencies, run the suite, and type-check against the Pi types with:

npm ci
npm test
npm run typecheck

Requirements

  • Pi coding agent (extension API; tested against 1.0.0)

License

MIT — see LICENSE.