gpu-rich
Free GPUs, driven from your terminal by your AI agent.
gpu-rich sends a Python script or a Jupyter notebook to a free or cheap GPU (Kaggle, Google Colab, Modal, Hugging Face Jobs, NVIDIA Brev, Vast.ai, or your own machine over SSH). It follows the run, and it brings the results back to your folder. A searchable index of public notebooks and fine-tuning recipes helps your coding agent find something to run.
It is made for students and people who start with machine learning and have no GPU budget.
Every terminal line and number in the demo comes from a real run on a free Kaggle T4.
Status
Alpha, on PyPI. Commands and JSON fields can still change.
The table says how far each backend is tested. "Tested with real runs" means that a full job ran on a real account: submit, logs, results, cancel.
| Backend | Cost | State |
|---|---|---|
kaggle |
free, about 30 GPU hours each week | tested with real runs |
colab |
free when a GPU is available; uses compute units when your account has them | tested with real runs on an account with compute units; the free path is not tested yet |
modal |
paid, 30 USD of monthly credits on the Starter plan | tested with real runs |
hf (Hugging Face Jobs) |
paid | experimental: built from documentation, never run on a real account |
brev (NVIDIA Brev) |
paid | experimental: built from documentation, never run on a real account |
vast (Vast.ai) |
paid, live marketplace price | tested with one real run; picks the cheapest machine that is at least as good as the GPU you name |
ssh:<host> |
your own machine | tested against a local fake host only |
local |
this machine | for smoke tests |
The Colab backend works on Linux and macOS only, because the official Colab CLI does not support Windows.
Install
You need Python 3.11 or newer and uv.
uv tool install gpu-rich
gpu-rich doctor
To try it without an install, run uvx gpu-rich doctor.
gpu-rich doctor lists every backend and gives one fix line for each backend that is not ready.
Your first run, on a free Kaggle GPU
- Create a Kaggle account and verify your phone number in the Kaggle settings. Kaggle gives GPU time to verified accounts only.
- Go to kaggle.com > Settings > API and create a token. Save it to
~/.kaggle/access_token. - Run
gpu-rich doctor. Thekaggleline must start withok. - Run the example. It fine-tunes a small text classifier with LoRA in about 5 minutes.
curl -LO https://raw.githubusercontent.com/mohamed2394/gpu-rich/main/examples/finetune_lora.py
gpu-rich run finetune_lora.py
The results come back to ./gpu-rich-runs/RUN_ID/outputs/: metrics.json and the LoRA adapter.
The Kaggle queue is slow at times. gpu-rich cancels a run that does not start in 5 minutes and submits it again, because a new submission usually starts in seconds.
Quickstart for a person (60 seconds)
gpu-rich doctor # which backends are ready, and how to fix the others
gpu-rich plan train.py # which backend would run it, and the cost
gpu-rich run train.py --detach # start it; prints a run id
gpu-rich wait RUN_ID --timeout 300 # wait up to 5 minutes; run it again until the run ends
gpu-rich pull RUN_ID # results in ./gpu-rich-runs/RUN_ID/
Stop a run with gpu-rich cancel RUN_ID.
Quickstart for an agent
Install the skill pack into your project, then start a new agent session:
gpu-rich skills install
This writes .agents/skills/gpu-rich/ (read by Codex CLI, Gemini CLI, Qwen Code and Cursor) and .claude/skills/gpu-rich/ (read by Claude Code). Use --global to install it for all your projects, and --agent NAME for one agent only.
Then ask your agent, for example: "Fine-tune a small model on my data in data/train.csv. I have no GPU."
The agent checks the backends, prepares the job, runs it detached, waits in bounded steps, fixes failures such as out-of-memory errors, and brings the results back.
Commands
Put --json before the command to get one JSON document on stdout (for agents and scripts).
| Command | What it does |
|---|---|
gpu-rich doctor |
Checks sign-in and quota for every backend, and says how to fix each problem. |
gpu-rich backends |
Lists the machines each backend offers, with price and quota. |
gpu-rich plan FILE |
Dry run: which backend would run the job, why, and the cost. |
gpu-rich run FILE |
Runs a script or a notebook. Use --detach to return at once. |
gpu-rich status [RUN] |
One run, or the recent runs. |
gpu-rich logs [RUN] |
The job's log. -f follows it, --tail N keeps the last lines. |
gpu-rich wait [RUN] |
Waits at most --timeout seconds, then prints the run. |
gpu-rich pull [RUN] |
Downloads the outputs, result.json and the executed notebook. |
gpu-rich cancel [RUN] |
Stops a run and frees the remote machine. |
gpu-rich search QUERY |
Searches the recipe catalog. |
gpu-rich show ID |
Shows one catalog entry: link, licence, needs. |
gpu-rich fetch ID |
Downloads a catalog entry from its upstream link. |
gpu-rich report [RUN] |
Shares the test result of a catalog run, when you agree. |
gpu-rich catalog info / update |
Shows or updates the local catalog index. |
gpu-rich skills install / path / show |
Installs or shows the agent skill pack. |
Exit codes: 0 ok, 1 the run failed, 2 wrong usage, 3 sign-in problem, 4 no backend or quota, 5 platform error.
The job header
A script says what it needs in a PEP 723 header. The same file still runs with plain uv run train.py.
# /// script
# requires-python = ">=3.11"
# dependencies = ["transformers", "datasets", "peft"]
#
# [tool.gpu-rich]
# gpu = "T4"
# max_hours = 2
# outputs = ["outputs"]
# include = ["data/train.csv"]
# secrets = ["HF_TOKEN"]
# ///
outputs: what comes back. Write your results underoutputs/.include: extra local files to send with the job.secrets: names of environment variables. The values come from your shell, never from the file.max_hours: the job stops at this time.
Notebooks keep the same keys in their metadata under gpu-rich. The full format is in skills/gpu-rich/references/job-format.md.
Rules the tool follows
- It uses the official CLI or API of each platform.
- It supports one account per platform.
- It ships no tunnel, no keep-alive trick and no model serving.
- It never starts a paid backend unless you allow it.
- It never writes a token into the code it sends.
Money safety
- Free backends come first. A paid backend runs only with
--allow-paidor--budget USDon the command, orbudget_usdin~/.gpu-rich/config.toml. planshows the estimated cost before you run anything.- Every job has a time limit (
max_hours). cancelstops the remote machine. Checkgpu-rich statusfor runs you forgot.- Colab uses your compute units when your account has a balance. Modal, Hugging Face Jobs and Brev cost money.
For contributors
- Tests:
uv run --group dev pytest. Live tests against real platforms run only withGPU_RICH_LIVE=1. - Adding a platform: docs/adding-a-backend.md.
- Release check with a real agent: docs/agent-e2e.md.
- The design: docs/plan.html.
The catalog is an index of 2,049 public notebooks and scripts from 19 repositories. It links to them and does not copy them. Most entries are not tested on these backends yet, so a recipe can fail because of its own dependencies.
A note on the language
The tool is written in Python, because the platform SDKs are Python and ML students already have it. Once everything is stable, a rewrite in Rust is inevitable. lol.
Licence
Apache-2.0. See LICENSE. The recipe catalog links to third-party notebooks; each one keeps its own licence.
Metadata
Release files for gpu-rich 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gpu_rich-0.0.3.tar.gz | 4.2 MB | Without provenance | Details for gpu_rich-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gpu_rich-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for gpu_rich-0.0.3-py3-none-any.whl |
Total release size: 8.2 MB
Release files / gpu_rich-0.0.3.tar.gz
| Download URL | gpu_rich-0.0.3.tar.gz |
|---|---|
| Size | 4.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73148d400fc76658388320938378a768f9a0c2e21cf2e9a4d64eb1411b30f69f
|
|
BLAKE2b-256 checksum How to use checksums |
3326904fb2bf952ccac371793011604cefae14f76017d35cb143f68a5cac8602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Release files / gpu_rich-0.0.3-py3-none-any.whl
| Download URL | gpu_rich-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb98e91e2b8d795b1c71d6b9c24d6f6e5d3ce9f460789c270e4d85170ecf6152
|
|
BLAKE2b-256 checksum How to use checksums |
ed43618f87ba0024dcdd2d58bba24fc71a4b82f594bfdfdf95d2e61399a15c70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Security for gpu-rich 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.