npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-ds-files

v0.1.0

Published

DeepSeek Files API for Pi — upload images once, reuse file_id references in requests to deepseek-v4-flash-vision-exp, slash fewer bandwidth bills.

Readme

pi-ds-files

DeepSeek Files API for Pi. Upload an image once, reference it by file_id in every later request to deepseek-v4-flash-vision-exp — instead of re-sending base64 every time.

  • Reuses the same image across requests (content-hash cache, no duplicate uploads)
  • Bypasses the 32 MiB inline image limit (Files API accepts up to 64 MiB)
  • Works automatically with the deepseek provider in pi
  • Zero runtime dependencies (Node built-ins only)

Install

pi install npm:pi-ds-files

Requires pi ≥ 0.6 and the DeepSeek API key already configured for the deepseek provider (in ~/.pi/agent/models.json or ~/.pi/agent/auth.json, or DEEPSEEK_API_KEY).

Add the vision model if you do not have it yet:

pi --list-models | grep vision-exp

How it works

image in provider payload (base64)
        │
        ▼
pi.on("before_provider_request")
        │
        ▼
hash(mime + bytes) ──► cache hit ──► reuse file_id
        │
        └────────────► cache miss ──► POST https://api.deepseek.com/files
                                     (multipart, purpose=user_data)
        │
        ▼
image block ──► { "type": "file", "file_id": "file-api-…" }

Only requests whose provider matches providerPatterns (default deepseek) and model matches modelPatterns (default deepseek-v4-flash-vision-exp) are rewritten. Everything else passes through untouched. If an upload fails, the original inline image is kept — a request is never broken.

Commands

| Command | What it does | | --- | --- | | /ds-files status | Show config, cache size, active model | | /ds-files list [--limit N] [--order asc\|desc] | List uploaded files | | /ds-files upload <path> [--expires SECONDS] | Upload an image, cache the file_id | | /ds-files delete <file_id> | Delete a remote file | | /ds-files prune | Drop expired/overflow cache entries | | /ds-files on / /ds-files off | Enable/disable rewriting | | /ds-files cache <path> | Point the cache at a custom file |

CLI

The package also installs a ds-files binary for scripting:

ds-files upload screenshot.png
ds-files upload big.png --expires 86400
ds-files list --limit 50
ds-files delete file-api-xxxxxxxxxxxxxxxx
ds-files status

Configuration

Config lives at ~/.pi/agent/extensions/pi-ds-files.json:

{
  "enabled": true,
  "providerPatterns": ["deepseek"],
  "modelPatterns": ["deepseek-v4-flash-vision-exp"],
  "maxCacheEntries": 500,
  "defaultExpirySeconds": null,
  "autoUpload": true,
  "verbose": false
}
  • defaultExpirySeconds: null = permanent, or 3600–2592000 (1h–30d)
  • autoUpload: when false, cache hits still rewrite but new images stay inline
  • Cache file: ~/.pi/agent/pi-ds-files-cache.json (override with cachePath or PI_DS_FILES_CACHE)

Limits (DeepSeek Files API)

  • Formats: JPEG, PNG, GIF, WebP
  • Max upload: 64 MiB per file
  • Storage: 25 GiB per user, 10,000 files
  • Expiry: 1h–30d or permanent

Development

npm test
pi -e ./extensions/index.ts   # quick load test

License

MIT