omp packages

pi-peak-guard0.1.1

Route paid DeepSeek models to an alternate Pi model during DeepSeek peak billing hours

vitalnohj Published 18 days ago MIT ~347 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 Peak Guard

A Pi extension that switches away from paid DeepSeek models during DeepSeek's peak billing hours. Choose your own alternate model; the package does not select a provider for you. Free DeepSeek routes and non-DeepSeek models are left alone.

Install

pi install npm:pi-peak-guard

Remove any older standalone copy of the guard from your Pi extensions directory to avoid loading it twice. Start a new Pi process or run /reload after installation.

Set up

In Pi, select an alternate model available from /model and enter its exact provider and model ID:

/peak-guard target <provider/model-id>
/peak-guard on
/peak-guard status

For example, if /model lists provider example and model flash, use /peak-guard target example/flash. The target must be registered, available to your Pi installation, and not a DeepSeek model. The guard starts off with no target; it will not silently select a model or change the model you're using until configured and enabled.

  • /peak-guard off: stop automatic routing without forgetting your target.
  • /peak-guard on: resume routing; requires a configured target.
  • /peak-guard target <provider/model-id>: change the alternate model. If the guard is on and you are using paid DeepSeek during peak, this switches immediately.
  • /peak-guard status: show the current setting, peak state, and target.

Settings persist outside the session in ~/.pi/agent/peak-guard.json (or $PI_CODING_AGENT_DIR/peak-guard.json) and are reread before routing. Different agent directories have independent settings. An existing installation with an enabled target in that file keeps its setting when upgraded.

Schedule

Peak: Monday-Friday, 01:00-04:00 and 06:00-10:00 UTC (inclusive start, exclusive end). The 04:00-06:00 UTC gap and weekends are off-peak. The local schedule does not account for Chinese public holidays, so it may switch models on weekday holidays even if DeepSeek charges off-peak rates. Review DeepSeek's current pricing schedule before relying on this extension; upstream windows may change.

The guard checks at session startup, on interactive model selection, before prompts, and at turn start. It recognizes paid DeepSeek routes by deepseek in the provider or model ID, excluding names with free. If the target cannot be found or authenticated, the guard warns and the DeepSeek request can proceed. This is a cost optimization, not a hard prohibition. Disabling extensions, calling a model outside Pi, or using a third-party route with a different billing schedule also bypasses it.

For testing, PI_DEEPSEEK_PEAK_GUARD=peak forces peak and PI_DEEPSEEK_PEAK_GUARD=off forces off-peak for that process without changing the saved setting. PI_DEEPSEEK_PEAK_GUARD_QUIET=1 hides successful redirect notices. Avoid persistent production use of these overrides.

Development

The package has no runtime dependencies. For the optional test suite, install development dependencies and run npm test on Node 22+; npm pack --dry-run shows the public package files. tests/rpc-smoke.mjs exercises a real Pi RPC process and needs registered source and alternate models specified with SMOKE_INPUTS, SMOKE_TARGET, and SMOKE_ALTERNATE_TARGET.