Skip to main content

Download and organize all your Replicate predictions, including images, videos, and metadata

Project description

Replicate Predictions Downloader (Python)

Download and organize all your Replicate predictions, including images, videos, 3D models, and metadata.

Why

Replicate doesn't keep your prediction data forever. Per their data retention policy, predictions created via the API have their inputs, outputs, files, and logs automatically removed after one hour by default. Predictions made on the website are kept indefinitely, but output files still need downloading if you want local copies. This tool grabs everything while it's still there.

Features

  • Batch download all your Replicate prediction outputs
  • Organize by model into clean directory structures
  • Smart filenames with dates, model names, and prompt snippets
  • ZIP archives for each model for easy backup
  • Date filtering - download predictions from specific time ranges
  • Incremental downloads - only fetch new predictions since last run
  • Full metadata export as JSON

Installation

pip install replicate-predictions-downloader

Or with pipx for isolated CLI usage:

pipx install replicate-predictions-downloader

Setup

  1. Get your API token from replicate.com/account/api-tokens

  2. Set your token:

    export REPLICATE_API_TOKEN=your_token_here
    

    Or create a .env file:

    REPLICATE_API_TOKEN=your_token_here
    

Usage

Download all predictions

replicate-downloader

Download predictions from a specific date

replicate-downloader --since "2024-01-15"
replicate-downloader --since "7 days ago"
replicate-downloader --since yesterday

Download predictions in a date range

replicate-downloader --since "2024-01-01" --until "2024-06-30"

Incremental download (since last run)

replicate-downloader --last-run

Output Structure

replicate_outputs_2024-01-15/
├── by-model/
│   ├── stable-diffusion/
│   │   ├── 2024-01-15_stable-diffusion_a-photo-of-an-astronaut_abc123.png
│   │   ├── 2024-01-15_stable-diffusion_sunset-over-mountains_def456.png
│   │   └── abc123_metadata.json
│   ├── stable-diffusion.zip
│   ├── flux-pro/
│   │   └── ...
│   └── flux-pro.zip
└── replicate_metadata_2024-01-15.json

Python API

You can also use the downloader programmatically:

from replicate_downloader import ReplicateDownloader

downloader = ReplicateDownloader(
    api_token="your_token",  # or use REPLICATE_API_TOKEN env var
    since="7 days ago",
)
downloader.run()

Options

Option Description
-s, --since DATE Download predictions created since this date
-u, --until DATE Download predictions created until this date
-l, --last-run Only download predictions since the last successful run
--all Download all predictions (default)
--version Show version
--help Show help

Date Formats

The --since and --until options support:

  • ISO format: 2024-01-15
  • Relative: yesterday, 7 days ago, 2 weeks ago, 1 month ago

Related

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

replicate_predictions_downloader-1.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file replicate_predictions_downloader-1.1.0.tar.gz.

File metadata

File hashes

Hashes for replicate_predictions_downloader-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0f3759ec45b9a1ffb53ba97fcbec8775040d0b8410943dc11d184aa9ced67a30
MD5 1b0f7adf7a22b22ced29b9c372f23cee
BLAKE2b-256 5ce16f815329af0e9ff16b509acfdccb4a7c0a107d2f6cfc53c71eefa31c954c

See more details on using hashes here.

File details

Details for the file replicate_predictions_downloader-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for replicate_predictions_downloader-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c7ceb24c6fe8bb1cc81b8a5487f4051e121dd2b7336633b3de306e20a4dac79
MD5 1478bc15c7e1072b22d3b21bc2268d56
BLAKE2b-256 eee70d3a6389bbb44d257546689fc64d77e6352f29b913ce3421ad8f7f49a2ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page