gpu4agents 0.9.2__tar.gz → 0.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.claude-plugin/plugin.json +1 -1
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.cursor-plugin/plugin.json +1 -1
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/CHANGELOG.md +13 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/INSTALL.md +1 -1
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/PKG-INFO +7 -7
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/PROVIDERS.md +2 -2
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/README.md +6 -6
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/ADDING_A_PROVIDER.md +17 -13
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/AGENTS.md +3 -3
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/CONFIG.md +36 -2
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/__init__.py +1 -1
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/agent/mcp.py +1 -1
- {gpu4agents-0.9.2/skills/gpu4agents → gpu4agents-0.10.0/gpu4agents/agent/skill}/SKILL.md +3 -3
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/account.py +2 -3
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/providers.py +2 -2
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/setup.py +10 -4
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/engine.py +3 -1
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/models.py +4 -0
- gpu4agents-0.10.0/gpu4agents/providers/gpus.py +70 -0
- gpu4agents-0.10.0/gpu4agents/providers/http.py +103 -0
- gpu4agents-0.10.0/gpu4agents/providers/lambdacloud/__init__.py +3 -0
- gpu4agents-0.10.0/gpu4agents/providers/lambdacloud/client.py +107 -0
- gpu4agents-0.10.0/gpu4agents/providers/lambdacloud/config.py +55 -0
- gpu4agents-0.10.0/gpu4agents/providers/lambdacloud/mapper.py +230 -0
- gpu4agents-0.10.0/gpu4agents/providers/lambdacloud/provider.py +471 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/registry.py +6 -3
- gpu4agents-0.10.0/gpu4agents/providers/runpod/__init__.py +3 -0
- gpu4agents-0.10.0/gpu4agents/providers/runpod/client.py +183 -0
- gpu4agents-0.10.0/gpu4agents/providers/runpod/config.py +61 -0
- gpu4agents-0.10.0/gpu4agents/providers/runpod/mapper.py +200 -0
- gpu4agents-0.10.0/gpu4agents/providers/runpod/provider.py +412 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/scaffold.py +6 -2
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/vast/provider.py +3 -1
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/install.sh +2 -2
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/pyproject.toml +1 -1
- {gpu4agents-0.9.2/gpu4agents/agent/skill → gpu4agents-0.10.0/skills/gpu4agents}/SKILL.md +3 -3
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/fakes.py +1 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_cli.py +49 -5
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_engine.py +17 -0
- gpu4agents-0.10.0/tests/test_lambda_provider.py +295 -0
- gpu4agents-0.10.0/tests/test_runpod_provider.py +324 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.claude-plugin/marketplace.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.env.example +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/dependabot.yml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/pull_request_template.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/workflows/ci.yml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.github/workflows/release.yml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/.gitignore +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/CODE_OF_CONDUCT.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/CONTRIBUTING.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/JOBS.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/LICENSE +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/SECURITY.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/SERVING.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/ACCEPTANCE.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/CHOOSING_A_MODEL.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/INTEGRATION.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/LIFECYCLE.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/USAGE.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/assets/banner.png +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/docs/assets/jambu-logo.jpg +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/experiment.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/gpu.yaml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/README.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/package-lock.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/package.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/src/agent.ts +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/src/index.ts +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/src/tools/weather-tool.ts +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/mastra-agent/tsconfig.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/typescript-client/README.md +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/typescript-client/package-lock.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/typescript-client/package.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/typescript-client/src/gpu.ts +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/typescript-client/src/index.ts +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/examples/typescript-client/tsconfig.json +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu.example.yaml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu.models.yaml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu.yaml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/__main__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/agent/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/agent/install.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/agent/jobs.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/_common.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/agent.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/inspect.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/job.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/lifecycle.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/main.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/run.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/status.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/timer.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/cli/validate.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/beacon.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/config.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/credentials.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/durations.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/errors.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/events.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/execution.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/health.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/hosts.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/job.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/model_inspect.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/paths.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/policy.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/state.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/sweep.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/core/tool_parsers.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/base.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/vast/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/vast/client.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/vast/config.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/providers/vast/mapper.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/runtime/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/runtime/base.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/runtime/service.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/runtime/vllm.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/hf/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/hf/install.sh +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/hf/server.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/template/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/template/gpujob.yaml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/serve/template/server.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/watchdog/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/watchdog/agent_body.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/watchdog/builder.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/gpu4agents/watchdog/jobs_ext.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/jambu_gpu/__init__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/jambu_gpu/__main__.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/skills/gpu4agents/agents/openai.yaml +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/conftest.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_agent.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_config.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_engine_sessions.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_integration.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_jobs.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_model_inspect.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_paths.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_policy.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_runtime_vllm.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_serve.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_state.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_sweep.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_vast_mapper.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_vast_provider.py +0 -0
- {gpu4agents-0.9.2 → gpu4agents-0.10.0}/tests/test_watchdog.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gpu4agents",
|
|
3
3
|
"description": "Your agent rents the GPU it needs, serves a model on it and runs the experiment. You pay only while it works.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "João Gabriel Lima",
|
|
7
7
|
"url": "https://www.linkedin.com/in/joaogabriellima"
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [0.10.0] - 2026-11-06
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **RunPod and Lambda are built in**, next to Vast.ai. `gpu login` lists all three, with the steps for each in plain words, and saves the one you pick; `gpu init` then writes it into `gpu.yaml` (`--provider` still overrides). The watchdog, budgets, `gpu ls`, `gpu sweep` and the MCP tools work the same on each.
|
|
9
|
+
- RunPod (`RUNPOD_API_KEY`) uses the REST API v2. A pod runs the model image with gpu's boot script; the model and watchdog are reached through RunPod's HTTPS proxy. Without a volume (`provider.options.volume_gb`, default 0) a stopped pod costs nothing. RunPod's API has no spot pods, and gpu does not SSH into pods: run code on the GPU with `gpu job`.
|
|
10
|
+
- Lambda (`LAMBDA_API_KEY`) rents whole VMs. gpu runs the model image on the VM with Docker, registers its own SSH key (kept in `$GPU_HOME/ssh/`) and creates a firewall ruleset per region for the model and watchdog ports. Lambda cannot stop a machine, so where another provider would stop, gpu and the watchdog terminate it. Instance types have a fixed GPU count (1, 2, 4 or 8).
|
|
11
|
+
- RunPod and Lambda report a GPU's model but not its architecture, so gpu looks it up (`providers/gpus.py`) and skips cards too old for the model image, as it already did on Vast.ai.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- `gpu init` without `--provider` uses the provider `gpu login` connected, instead of always Vast.ai.
|
|
15
|
+
- `health.pull_stall_timeout` applies only to providers that report the image pull moving while a machine boots (the new `boot_progress` capability; Vast.ai does). On the others, a long pull is waited out until `health.boot_timeout`, instead of being taken for a stall after ten quiet minutes.
|
|
16
|
+
- The website and docs: a table of how the three providers differ, at `/docs#providers`, and the adapter examples now use a provider that is not built in.
|
|
17
|
+
|
|
5
18
|
## [0.9.2] - 2026-11-06
|
|
6
19
|
|
|
7
20
|
### Changed
|
|
@@ -20,7 +20,7 @@ curl -fsSL https://raw.githubusercontent.com/jambuai/gpu4agents/main/install.sh
|
|
|
20
20
|
|
|
21
21
|
The script needs only `curl` (Linux or macOS; on Windows, run it inside WSL). It installs [uv](https://docs.astral.sh/uv/) if missing, uses it to install the `gpu4agents` package with a Python it downloads by itself, and then installs the skill and registers the `gpu` MCP server for your runtime. It does not ask for or read any key.
|
|
22
22
|
|
|
23
|
-
Check: `~/.local/bin/gpu --version` prints 0.
|
|
23
|
+
Check: `~/.local/bin/gpu --version` prints 0.10.0 or later.
|
|
24
24
|
|
|
25
25
|
For the rest of this session, call the command by its full path, `~/.local/bin/gpu`. Your shell may define `gpu` as an alias: Oh My Zsh's git plugin, on by default, makes `gpu` mean `git push upstream`, and an alias wins over the command, so plain `gpu setup` could run git instead. The installer removes that alias for new shells and says so; tell the user if it did. The same command is also installed as `gpu4agents`.
|
|
26
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: gpu4agents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: GPU for Agents: your coding agent rents the GPU it needs, on its own. You pay only while it works.
|
|
5
5
|
Project-URL: Homepage, https://gpu4agents.jambu.ai
|
|
6
6
|
Project-URL: Documentation, https://github.com/jambuai/gpu4agents/tree/main/docs
|
|
@@ -69,7 +69,7 @@ Ask Claude Code, Codex, Gemini CLI or Cursor to "compare Qwen 7B and Llama 8B on
|
|
|
69
69
|
|
|
70
70
|
The agent installs it from one pasted line. A skill and local MCP tools (`gpu_offers`, `gpu_setup`, `gpu_run`, `gpu_status`, `gpu_destroy`, ...) cover the whole lifecycle, and the skill tells the agent to show you the price and ask before renting. Budgets, a maximum lifetime and an account-wide sweep catch anything left behind. Apps in any language get the endpoint from `gpu --json setup`.
|
|
71
71
|
|
|
72
|
-
Vast.ai
|
|
72
|
+
Vast.ai, RunPod and Lambda are built in. Any other GPU provider takes one adapter file, and your agent can write it: see [Use any GPU provider](#use-any-gpu-provider).
|
|
73
73
|
|
|
74
74
|
## Installation
|
|
75
75
|
|
|
@@ -122,8 +122,8 @@ uv tool install gpu4agents && gpu agent install -t auto --global # the same,
|
|
|
122
122
|
Run this in your own terminal, so the agent never sees the key:
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
|
-
gpu login # pick
|
|
126
|
-
gpu login --provider
|
|
125
|
+
gpu login # pick Vast.ai, RunPod or Lambda; it walks you through the account and the key
|
|
126
|
+
gpu login --provider lambda # go straight to one provider (also one you added an adapter for)
|
|
127
127
|
gpu login --check # which account gpu finds, and its balance
|
|
128
128
|
```
|
|
129
129
|
|
|
@@ -164,7 +164,7 @@ Requests count as activity, so the machine stays up while clients call it and st
|
|
|
164
164
|
|
|
165
165
|
## Use any GPU provider
|
|
166
166
|
|
|
167
|
-
`gpu` talks to providers through a small contract: find offers, rent, report status, stop, destroy, and two calls the watchdog makes from the machine to shut itself down. Vast.ai
|
|
167
|
+
`gpu` talks to providers through a small contract: find offers, rent, report status, stop, destroy, and two calls the watchdog makes from the machine to shut itself down. Vast.ai, RunPod and Lambda ship with it. For anything else, such as CoreWeave, Paperspace or your company's cluster, paste this into your agent:
|
|
168
168
|
|
|
169
169
|
```text
|
|
170
170
|
Add <provider> to GPU for Agents. Fetch https://gpu4agents.jambu.ai/providers.md with curl and follow its steps.
|
|
@@ -175,8 +175,8 @@ The agent runs `gpu providers new <name>`, fills in the adapter from the provide
|
|
|
175
175
|
```yaml
|
|
176
176
|
gpu_runtime:
|
|
177
177
|
provider:
|
|
178
|
-
name:
|
|
179
|
-
plugin: ./gpu_providers/
|
|
178
|
+
name: acme
|
|
179
|
+
plugin: ./gpu_providers/acme.py:AcmeProvider
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
To reuse an adapter across projects, publish it as a package with a `gpu4agents.providers` entry point. The watchdog, budgets, CLI and MCP tools work the same with every provider. See [PROVIDERS.md](PROVIDERS.md) and [Adding a provider](docs/ADDING_A_PROVIDER.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Add a GPU provider to GPU for Agents (instructions for the agent)
|
|
2
2
|
|
|
3
|
-
You are a coding agent, and the user wants GPU for Agents (`gpu`) to rent from a provider it does not ship with, such as
|
|
3
|
+
You are a coding agent, and the user wants GPU for Agents (`gpu`) to rent from a provider it does not ship with, such as CoreWeave, Paperspace, a company cluster or their own servers. Vast.ai, RunPod and Lambda are built in (`gpu login` offers them; nothing to write). Any other provider is one Python file that implements the provider contract. The core, the watchdog that stops idle machines, the CLI and the MCP tools stay the same.
|
|
4
4
|
|
|
5
5
|
Follow these steps in the user's project directory. Do not rent anything until step 6, and ask first.
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ In an existing `gpu.yaml`, add those two lines under `gpu_runtime.provider` your
|
|
|
28
28
|
|
|
29
29
|
## 3. Read the provider's API docs, then fill in the file
|
|
30
30
|
|
|
31
|
-
Every `todo(...)` call marks a part that needs the provider's API; until you write it, that part fails with a clear error (exit 9). Read the contract in `gpu4agents/providers/base.py` (run `python -c "import gpu4agents.providers.base as b; print(b.__file__)"` to find it) and the guide at https://github.com/jambuai/gpu4agents/blob/main/docs/ADDING_A_PROVIDER.md. The
|
|
31
|
+
Every `todo(...)` call marks a part that needs the provider's API; until you write it, that part fails with a clear error (exit 9). Read the contract in `gpu4agents/providers/base.py` (run `python -c "import gpu4agents.providers.base as b; print(b.__file__)"` to find it) and the guide at https://github.com/jambuai/gpu4agents/blob/main/docs/ADDING_A_PROVIDER.md. The built-in adapters are full working examples: `gpu4agents/providers/vast/` (a marketplace of containers), `runpod/` (containers behind an HTTPS proxy) and `lambdacloud/` (whole VMs, where the image runs under Docker and the machine can only be terminated).
|
|
32
32
|
|
|
33
33
|
What each part must do:
|
|
34
34
|
|
|
@@ -28,7 +28,7 @@ Ask Claude Code, Codex, Gemini CLI or Cursor to "compare Qwen 7B and Llama 8B on
|
|
|
28
28
|
|
|
29
29
|
The agent installs it from one pasted line. A skill and local MCP tools (`gpu_offers`, `gpu_setup`, `gpu_run`, `gpu_status`, `gpu_destroy`, ...) cover the whole lifecycle, and the skill tells the agent to show you the price and ask before renting. Budgets, a maximum lifetime and an account-wide sweep catch anything left behind. Apps in any language get the endpoint from `gpu --json setup`.
|
|
30
30
|
|
|
31
|
-
Vast.ai
|
|
31
|
+
Vast.ai, RunPod and Lambda are built in. Any other GPU provider takes one adapter file, and your agent can write it: see [Use any GPU provider](#use-any-gpu-provider).
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
@@ -81,8 +81,8 @@ uv tool install gpu4agents && gpu agent install -t auto --global # the same,
|
|
|
81
81
|
Run this in your own terminal, so the agent never sees the key:
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
gpu login # pick
|
|
85
|
-
gpu login --provider
|
|
84
|
+
gpu login # pick Vast.ai, RunPod or Lambda; it walks you through the account and the key
|
|
85
|
+
gpu login --provider lambda # go straight to one provider (also one you added an adapter for)
|
|
86
86
|
gpu login --check # which account gpu finds, and its balance
|
|
87
87
|
```
|
|
88
88
|
|
|
@@ -123,7 +123,7 @@ Requests count as activity, so the machine stays up while clients call it and st
|
|
|
123
123
|
|
|
124
124
|
## Use any GPU provider
|
|
125
125
|
|
|
126
|
-
`gpu` talks to providers through a small contract: find offers, rent, report status, stop, destroy, and two calls the watchdog makes from the machine to shut itself down. Vast.ai
|
|
126
|
+
`gpu` talks to providers through a small contract: find offers, rent, report status, stop, destroy, and two calls the watchdog makes from the machine to shut itself down. Vast.ai, RunPod and Lambda ship with it. For anything else, such as CoreWeave, Paperspace or your company's cluster, paste this into your agent:
|
|
127
127
|
|
|
128
128
|
```text
|
|
129
129
|
Add <provider> to GPU for Agents. Fetch https://gpu4agents.jambu.ai/providers.md with curl and follow its steps.
|
|
@@ -134,8 +134,8 @@ The agent runs `gpu providers new <name>`, fills in the adapter from the provide
|
|
|
134
134
|
```yaml
|
|
135
135
|
gpu_runtime:
|
|
136
136
|
provider:
|
|
137
|
-
name:
|
|
138
|
-
plugin: ./gpu_providers/
|
|
137
|
+
name: acme
|
|
138
|
+
plugin: ./gpu_providers/acme.py:AcmeProvider
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
To reuse an adapter across projects, publish it as a package with a `gpu4agents.providers` entry point. The watchdog, budgets, CLI and MCP tools work the same with every provider. See [PROVIDERS.md](PROVIDERS.md) and [Adding a provider](docs/ADDING_A_PROVIDER.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Adding a provider
|
|
2
2
|
|
|
3
|
-
Vast.ai
|
|
3
|
+
Vast.ai, RunPod and Lambda are built in. Any other provider is a class that implements
|
|
4
4
|
the contract in `gpu4agents/providers/base.py`. Lifecycle, execution and CLI code
|
|
5
5
|
stay the same; if you find yourself editing `core/`, the contract is leaking.
|
|
6
6
|
|
|
@@ -30,16 +30,16 @@ The rest of this guide applies to all three routes.
|
|
|
30
30
|
## 1. Implement the contract
|
|
31
31
|
|
|
32
32
|
```python
|
|
33
|
-
# gpu4agents/providers/
|
|
33
|
+
# gpu4agents/providers/acme/provider.py
|
|
34
34
|
from ...core.models import ProviderCapabilities
|
|
35
35
|
from ..base import GPUProvider, WatchdogSpec
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
class
|
|
39
|
-
name = "
|
|
40
|
-
display_name = "
|
|
41
|
-
required_credentials = ["
|
|
42
|
-
credentials_url = "https://
|
|
38
|
+
class AcmeProvider(GPUProvider):
|
|
39
|
+
name = "acme"
|
|
40
|
+
display_name = "Acme GPU"
|
|
41
|
+
required_credentials = ["ACME_API_KEY"]
|
|
42
|
+
credentials_url = "https://console.acme.example/api-keys"
|
|
43
43
|
capabilities = ProviderCapabilities(
|
|
44
44
|
stop=True,
|
|
45
45
|
destroy=True,
|
|
@@ -64,16 +64,16 @@ class RunpodProvider(GPUProvider):
|
|
|
64
64
|
def logs(self, instance): ...
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
`gpu login --provider
|
|
67
|
+
`gpu login --provider acme` prompts for each name in `required_credentials`,
|
|
68
68
|
passes the values to `verify_credentials`, and saves them in
|
|
69
69
|
`~/.gpu/credentials` only if it returns. Raise `AuthenticationError` for a
|
|
70
70
|
rejected key, and return only fields that are safe to print, such as
|
|
71
71
|
`{"balance_usd": 12.5}`.
|
|
72
72
|
|
|
73
|
-
For an adapter that ships in this repository, mirror the
|
|
73
|
+
For an adapter that ships in this repository, mirror the layout of `vast/`, `runpod/` or `lambdacloud/`:
|
|
74
74
|
|
|
75
75
|
```
|
|
76
|
-
providers/
|
|
76
|
+
providers/acme/
|
|
77
77
|
├── provider.py the contract implementation
|
|
78
78
|
├── client.py raw HTTP; the ONLY place that knows the wire format
|
|
79
79
|
├── mapper.py payloads <-> normalized models, state mapping
|
|
@@ -86,6 +86,10 @@ The core branches on `provider.capabilities`, never on `provider.name`. Set
|
|
|
86
86
|
`stop_eliminates_billing=False` if a stopped instance still costs money; the policy
|
|
87
87
|
then knows it may need to escalate to destroy, and `lifecycle.stopped_ttl` applies.
|
|
88
88
|
|
|
89
|
+
Set `boot_progress=True` only if, while the machine boots, `status().message` shows the image
|
|
90
|
+
pull moving (a new line per layer, as Vast.ai does). The core then gives up on a pull that
|
|
91
|
+
stops moving for `health.pull_stall_timeout`; without it, only `health.boot_timeout` applies.
|
|
92
|
+
|
|
89
93
|
Set `list_instances=True` and implement `list_instances()` if the API can enumerate
|
|
90
94
|
the account. Return only instances whose label starts with `JAMBU_LABEL_PREFIX`
|
|
91
95
|
(`core/models.py`); `gpu ls` and `gpu sweep` are built on it and stay unavailable
|
|
@@ -123,7 +127,7 @@ def provider_destroy(ctx):
|
|
|
123
127
|
def watchdog_spec(self, spec_or_instance=None):
|
|
124
128
|
return WatchdogSpec(
|
|
125
129
|
actions_source=WATCHDOG_ACTIONS,
|
|
126
|
-
env={"
|
|
130
|
+
env={"ACME_API_KEY": self.credentials.get("ACME_API_KEY") or ""},
|
|
127
131
|
context={"provider": self.name},
|
|
128
132
|
)
|
|
129
133
|
```
|
|
@@ -151,10 +155,10 @@ ships in this repository is added here:
|
|
|
151
155
|
# providers/registry.py
|
|
152
156
|
def load_builtin_providers():
|
|
153
157
|
from .vast.provider import VastProvider
|
|
154
|
-
from .
|
|
158
|
+
from .acme.provider import AcmeProvider
|
|
155
159
|
|
|
156
160
|
registry.register(VastProvider)
|
|
157
|
-
registry.register(
|
|
161
|
+
registry.register(AcmeProvider)
|
|
158
162
|
return registry
|
|
159
163
|
```
|
|
160
164
|
|
|
@@ -35,14 +35,14 @@ The user, in their own terminal:
|
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
gpu login # the first time: pick a provider, follow the steps, paste the key (hidden)
|
|
38
|
-
gpu login --provider runpod #
|
|
38
|
+
gpu login --provider runpod # straight to one provider (built in, or one added with an adapter)
|
|
39
39
|
gpu login --check # exit 0, the provider and where the key was found; or exit 5
|
|
40
40
|
echo "$KEY" | gpu login --stdin
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Run with no project and no saved provider, `gpu login` first lists the providers it can use: Vast.ai, ready out of the box, and "another provider I already use", which tells the user to ask their agent to add it ([`PROVIDERS.md`](../PROVIDERS.md)). For
|
|
43
|
+
Run with no project and no saved provider, `gpu login` first lists the providers it can use: Vast.ai, RunPod and Lambda, ready out of the box, and "another provider I already use", which tells the user to ask their agent to add it ([`PROVIDERS.md`](../PROVIDERS.md)). For the chosen provider it then shows the steps in plain words (create the account, add credit or a card, copy the key) before the hidden prompt. An adapter supplies its own steps with `tagline`, `signup_url` and `setup_steps`.
|
|
44
44
|
|
|
45
|
-
Otherwise the provider is the one `--provider` names, else the project's `gpu.yaml`, else `GPU_PROVIDER`, else Vast.ai. `gpu login --provider NAME` also saves `GPU_PROVIDER=NAME`, so `gpu ls` and `gpu sweep` outside a project use that provider. The key goes to `~/.gpu/credentials` (mode 600, directory 700); other lines in the file are kept. A key in the environment or a project `.env` still works and wins over the file. The skill tells the agent never to ask for the key in chat, read those files, or print it.
|
|
45
|
+
Otherwise the provider is the one `--provider` names, else the project's `gpu.yaml`, else `GPU_PROVIDER`, else Vast.ai. `gpu login --provider NAME` also saves `GPU_PROVIDER=NAME`, so `gpu ls` and `gpu sweep` outside a project use that provider, and `gpu init` writes it into a new `gpu.yaml`. The key goes to `~/.gpu/credentials` (mode 600, directory 700); other lines in the file are kept. A key in the environment or a project `.env` still works and wins over the file. The skill tells the agent never to ask for the key in chat, read those files, or print it.
|
|
46
46
|
|
|
47
47
|
## When `gpu` is a shell alias
|
|
48
48
|
|
|
@@ -52,8 +52,8 @@ for why this exists and `gpu profiles` / `gpu inspect-model
|
|
|
52
52
|
|
|
53
53
|
| Field | Default | Meaning |
|
|
54
54
|
| --- | --- | --- |
|
|
55
|
-
| `name` | `vast` | Adapter to use. `gpu providers` lists what is available. |
|
|
56
|
-
| `profile` | `default` | Credential profile. Looks up `VAST_API_KEY__<profile>`
|
|
55
|
+
| `name` | `vast` | Adapter to use: `vast`, `runpod`, `lambda`, or one you added. `gpu providers` lists what is available. `gpu init` writes the one `gpu login` connected. |
|
|
56
|
+
| `profile` | `default` | Credential profile. Looks up `VAST_API_KEY__<profile>` (or `RUNPOD_API_KEY__<profile>`, ...) before the plain name. |
|
|
57
57
|
| `options` | `{}` | Provider-specific tuning, validated by the adapter (see below). |
|
|
58
58
|
|
|
59
59
|
### `provider.options` for vast
|
|
@@ -71,6 +71,40 @@ for why this exists and `gpu profiles` / `gpu inspect-model
|
|
|
71
71
|
| `image_login` | – | `-u user -p pass docker.io` for a private image. |
|
|
72
72
|
| `search_filters` | – | Raw extra filters merged into the offer query. |
|
|
73
73
|
|
|
74
|
+
### `provider.options` for runpod
|
|
75
|
+
|
|
76
|
+
A pod is a container. Its model and watchdog ports are reached through RunPod's
|
|
77
|
+
HTTPS proxy (`https://POD-PORT.proxy.runpod.net`), which ends a single request after
|
|
78
|
+
100 seconds; streamed answers are not cut. RunPod's API has no spot pods, and `gpu`
|
|
79
|
+
does not SSH into pods, so `workload.mode: remote` is refused (use `gpu job`).
|
|
80
|
+
|
|
81
|
+
| Field | Default | Meaning |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `api_base` | `https://api.runpod.io` | REST API v2 endpoint. |
|
|
84
|
+
| `cloud` | `any` | `secure` (RunPod's own data centers), `community` (vetted hosts) or `any` (the cheaper of the two). |
|
|
85
|
+
| `volume_gb` | `0` | Persistent volume at `/workspace`. With none, a stopped pod costs nothing but downloads the model again when it starts. With one, a stopped pod bills the volume, so `lifecycle.stopped_ttl` applies. |
|
|
86
|
+
| `skip_low_availability` | `false` | Leave out GPU types RunPod reports as scarce. |
|
|
87
|
+
|
|
88
|
+
`compute.region` picks data centers by prefix: `US`, `EU-RO-1`, `US-TX,CA`.
|
|
89
|
+
|
|
90
|
+
### `provider.options` for lambda
|
|
91
|
+
|
|
92
|
+
A Lambda machine is a whole VM. `gpu` runs the model image on it with Docker, and
|
|
93
|
+
opens the model and watchdog ports with a firewall ruleset it creates per region
|
|
94
|
+
(`gpu4agents-PORT-PORT`). Lambda cannot stop a machine, only terminate it, so where
|
|
95
|
+
another provider would stop, `gpu` and the watchdog terminate. Instance types have a
|
|
96
|
+
fixed GPU count (1, 2, 4 or 8) and a fixed disk; `compute.gpu.count` must match one.
|
|
97
|
+
`gpu` keeps the SSH key it registers with Lambda in `$GPU_HOME/ssh/lambda_ed25519`.
|
|
98
|
+
|
|
99
|
+
| Field | Default | Meaning |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| `api_base` | `https://cloud.lambda.com/api/v1` | API endpoint. |
|
|
102
|
+
| `image_family` | – | VM image, e.g. `lambda-stack-22-04`. Unset: Lambda's default, which has Docker and the NVIDIA container toolkit. |
|
|
103
|
+
| `allow_arm64` | `false` | Also rent Arm machines (GH200). The usual model images are x86 only. |
|
|
104
|
+
| `source_network` | `0.0.0.0/0` | Who may reach the model and watchdog ports. The model still demands its API key and the watchdog its token. |
|
|
105
|
+
|
|
106
|
+
`compute.region` picks regions by prefix: `us-east`, `europe-central-1`.
|
|
107
|
+
|
|
74
108
|
## `compute`
|
|
75
109
|
|
|
76
110
|
`gpu inspect-model <repo>` reads a model's HuggingFace metadata and suggests
|
|
@@ -59,7 +59,7 @@ EXIT_MEANINGS = {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
INSTRUCTIONS = """\
|
|
62
|
-
gpu rents a cloud GPU (Vast.ai built in; other providers through an adapter),
|
|
62
|
+
gpu rents a cloud GPU (Vast.ai, RunPod and Lambda built in; other providers through an adapter),
|
|
63
63
|
serves a model on it behind an OpenAI-compatible API, and stops it by itself
|
|
64
64
|
when nobody uses it. Any Hugging Face model: chat models on vLLM; image,
|
|
65
65
|
speech, transcription, embeddings and other pipeline models on gpu's own
|
|
@@ -7,7 +7,7 @@ description: GPU for Agents. Rent a cloud GPU on your own, serve an open-weights
|
|
|
7
7
|
|
|
8
8
|
`gpu` (the `gpu4agents` package) rents a machine from a GPU provider, serves a model on it with vLLM behind an OpenAI-compatible API or runs your own code on it as a job, and installs a watchdog on the machine. The watchdog shuts the machine down once nothing has used it for `idle_timeout` (15 min by default), so billing ends even if this conversation does.
|
|
9
9
|
|
|
10
|
-
Vast.ai
|
|
10
|
+
Vast.ai, RunPod and Lambda are built in. Any other provider (CoreWeave, Paperspace, a company cluster) plugs in through an adapter: one Python file that implements the provider contract. See "Another provider" below.
|
|
11
11
|
|
|
12
12
|
Each project directory has a `gpu.yaml` (what to rent and serve, and from which provider) and a `.gpu/` directory (what was rented). One project, one machine.
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ Do these in order. Skip a step whose check already passes.
|
|
|
17
17
|
|
|
18
18
|
### 1. Install the `gpu` command
|
|
19
19
|
|
|
20
|
-
Check: `gpu --version` prints 0.
|
|
20
|
+
Check: `gpu --version` prints 0.10.0 or later. First run `type gpu`: if it says `gpu` is an alias or a function (Oh My Zsh's git plugin makes it `git push upstream`), plain `gpu` runs that instead, so use `command gpu`, `~/.local/bin/gpu` or `gpu4agents` for every command in this session. In a git repository the alias would really push. If the command is missing or older, install it (Linux and macOS; on Windows, use WSL):
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
curl -fsSL https://gpu4agents.jambu.ai/install.sh | sh -s -- --agent <runtime>
|
|
@@ -33,7 +33,7 @@ Check: `gpu login --check` exits 0. It prints the provider, where the key was fo
|
|
|
33
33
|
|
|
34
34
|
If it exits 5, no account is connected yet. The user may not be technical, so skip jargon like "API key" and tell them, in these words or close:
|
|
35
35
|
|
|
36
|
-
> One step left, about two minutes: connect the account that pays for the GPUs. Open your terminal app (not this chat) and type `gpu login`. It shows the providers you can use and walks you through it: Vast.ai
|
|
36
|
+
> One step left, about two minutes: connect the account that pays for the GPUs. Open your terminal app (not this chat) and type `gpu login`. It shows the providers you can use and walks you through it: Vast.ai, RunPod and Lambda work right away, and if you already use another one (your company's servers, for example), pick "Another provider" and I'll add it. Your key stays on your computer; I never see it.
|
|
37
37
|
|
|
38
38
|
If they pick another provider, write its adapter ("Another provider" below), then ask them to run `gpu login --provider <name>` in their terminal.
|
|
39
39
|
|
|
@@ -390,7 +390,6 @@ def login_command(
|
|
|
390
390
|
try:
|
|
391
391
|
cls, credentials = _login_target(context, provider)
|
|
392
392
|
names = list(cls.required_credentials)
|
|
393
|
-
where_to_get = f" (create one at {cls.credentials_url})" if cls.credentials_url else ""
|
|
394
393
|
if check:
|
|
395
394
|
missing = [name for name in names if not credentials.get(name)]
|
|
396
395
|
if missing:
|
|
@@ -398,7 +397,7 @@ def login_command(
|
|
|
398
397
|
f"no GPU provider account is connected yet ({cls.display_name}: "
|
|
399
398
|
f"{', '.join(missing)} not found). In your own terminal, run "
|
|
400
399
|
f"`gpu login{'' if provider is None else ' --provider ' + cls.name}`: "
|
|
401
|
-
|
|
400
|
+
"it walks you through it in about two minutes"
|
|
402
401
|
)
|
|
403
402
|
values = {name: credentials.get(name) or "" for name in names}
|
|
404
403
|
source = (credentials.file_source(names[0]) or "environment") if names else "none needed"
|
|
@@ -481,7 +480,7 @@ def _choose_provider(classes: list, default):
|
|
|
481
480
|
other = len(classes) + 1
|
|
482
481
|
console.print(
|
|
483
482
|
f" {other}) Another provider I already use "
|
|
484
|
-
"[dim]
|
|
483
|
+
"[dim]CoreWeave, Paperspace, my company's servers, ...: your agent adds it[/dim]\n",
|
|
485
484
|
highlight=False,
|
|
486
485
|
)
|
|
487
486
|
choice = typer.prompt("Choose", default="1", err=True).strip()
|
|
@@ -155,8 +155,8 @@ def providers_command(ctx: typer.Context) -> None:
|
|
|
155
155
|
if row["missing_credentials"]:
|
|
156
156
|
console.print(
|
|
157
157
|
Text(
|
|
158
|
-
f" {row['provider']}:
|
|
159
|
-
|
|
158
|
+
f" {row['provider']}: not connected; run `gpu login --provider {row['provider']}` "
|
|
159
|
+
"in your terminal",
|
|
160
160
|
style="yellow",
|
|
161
161
|
)
|
|
162
162
|
)
|
|
@@ -28,10 +28,13 @@ from ._common import console, fmt_money, get_context, handle, print_json, regist
|
|
|
28
28
|
def init_command(
|
|
29
29
|
ctx: typer.Context,
|
|
30
30
|
model: str = typer.Option("empero-ai/Qwythos-9B-v2", "--model", help="HuggingFace model id."),
|
|
31
|
-
provider: str = typer.Option(
|
|
32
|
-
|
|
31
|
+
provider: Optional[str] = typer.Option(
|
|
32
|
+
None,
|
|
33
33
|
"--provider",
|
|
34
|
-
help=
|
|
34
|
+
help=(
|
|
35
|
+
"GPU provider: vast, runpod or lambda (default: the one `gpu login` connected, else vast). "
|
|
36
|
+
"One gpu does not ship is loaded from gpu_providers/NAME.py (gpu providers new NAME)."
|
|
37
|
+
),
|
|
35
38
|
),
|
|
36
39
|
jobs: bool = typer.Option(
|
|
37
40
|
False,
|
|
@@ -78,6 +81,9 @@ def init_command(
|
|
|
78
81
|
from ..providers import scaffold
|
|
79
82
|
from ..providers.registry import load_builtin_providers
|
|
80
83
|
|
|
84
|
+
from .account import default_provider_name
|
|
85
|
+
|
|
86
|
+
provider = provider or default_provider_name()
|
|
81
87
|
try:
|
|
82
88
|
credential_names = list(load_builtin_providers().get_class(provider).required_credentials)
|
|
83
89
|
plugin = None
|
|
@@ -182,7 +188,7 @@ def init_command(
|
|
|
182
188
|
console.print(
|
|
183
189
|
Text(f"! {provider} is not built in: run `gpu providers new {provider}` and fill in the adapter", style="yellow")
|
|
184
190
|
)
|
|
185
|
-
login =
|
|
191
|
+
login = f"gpu login --provider {provider}"
|
|
186
192
|
console.print(f"next: {login} && gpu validate")
|
|
187
193
|
if engine == "none":
|
|
188
194
|
console.print("then: gpu job run -- python your_script.py (see `gpu job --help`)")
|
|
@@ -823,7 +823,9 @@ class Engine:
|
|
|
823
823
|
instance = state.instance
|
|
824
824
|
assert instance is not None
|
|
825
825
|
boot_timeout = self.config.boot_timeout_s
|
|
826
|
-
stall_timeout =
|
|
826
|
+
stall_timeout = (
|
|
827
|
+
self.config.pull_stall_timeout_s if self.provider.capabilities.boot_progress else None
|
|
828
|
+
)
|
|
827
829
|
deadline = time.time() + boot_timeout
|
|
828
830
|
announced = False
|
|
829
831
|
# Live, healthy pulls printed a new line every 1-8 minutes; stalled ones
|
|
@@ -80,6 +80,10 @@ class ProviderCapabilities:
|
|
|
80
80
|
stop_eliminates_billing: bool = True
|
|
81
81
|
# Can enumerate this tool's instances account-wide (`gpu ls`, `gpu sweep`).
|
|
82
82
|
list_instances: bool = False
|
|
83
|
+
# While booting, the status message shows the image pull moving (a new
|
|
84
|
+
# line per layer). Only then can a stalled pull be told from a slow one
|
|
85
|
+
# (health.pull_stall_timeout); otherwise boot_timeout alone applies.
|
|
86
|
+
boot_progress: bool = False
|
|
83
87
|
|
|
84
88
|
def as_row(self) -> dict[str, str]:
|
|
85
89
|
return {k: ("yes" if v else "no") for k, v in self.__dict__.items()}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""What adapters know about GPU models that some provider APIs do not say.
|
|
2
|
+
|
|
3
|
+
Vast.ai reports each offer's compute capability; RunPod and Lambda report
|
|
4
|
+
only a model name. The runtime needs the architecture (an image built for
|
|
5
|
+
Ampere dies on a Volta card), so adapters look the name up here. A name not
|
|
6
|
+
listed returns None, and the offer is not filtered on it.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import re
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
# Substring of the GPU name (lowercase, spaces removed) -> compute capability.
|
|
15
|
+
# Longest keys are tried first, so "a100" never shadows "a1000".
|
|
16
|
+
_COMPUTE_CAP = {
|
|
17
|
+
"b300": 10.3,
|
|
18
|
+
"b200": 10.0,
|
|
19
|
+
"gb200": 10.0,
|
|
20
|
+
"rtx5090": 12.0,
|
|
21
|
+
"rtx5080": 12.0,
|
|
22
|
+
"rtxpro6000": 12.0,
|
|
23
|
+
"h200": 9.0,
|
|
24
|
+
"h100": 9.0,
|
|
25
|
+
"gh200": 9.0,
|
|
26
|
+
"l40s": 8.9,
|
|
27
|
+
"l40": 8.9,
|
|
28
|
+
"l4": 8.9,
|
|
29
|
+
"rtx4090": 8.9,
|
|
30
|
+
"rtx4080": 8.9,
|
|
31
|
+
"rtx4070": 8.9,
|
|
32
|
+
"rtx6000ada": 8.9,
|
|
33
|
+
"rtx5000ada": 8.9,
|
|
34
|
+
"rtx4000ada": 8.9,
|
|
35
|
+
"rtx2000ada": 8.9,
|
|
36
|
+
"a100": 8.0,
|
|
37
|
+
"a30": 8.0,
|
|
38
|
+
"a40": 8.6,
|
|
39
|
+
"a10g": 8.6,
|
|
40
|
+
"a10": 8.6,
|
|
41
|
+
"a16": 8.6,
|
|
42
|
+
"a6000": 8.6,
|
|
43
|
+
"a5000": 8.6,
|
|
44
|
+
"a4500": 8.6,
|
|
45
|
+
"a4000": 8.6,
|
|
46
|
+
"a2000": 8.6,
|
|
47
|
+
"rtx3090": 8.6,
|
|
48
|
+
"rtx3080": 8.6,
|
|
49
|
+
"rtx3070": 8.6,
|
|
50
|
+
"rtx3060": 8.6,
|
|
51
|
+
"quadrortx6000": 7.5,
|
|
52
|
+
"rtx6000": 7.5, # Quadro RTX 6000 (Turing); the Ada and Pro cards match longer keys
|
|
53
|
+
"quadrortx8000": 7.5,
|
|
54
|
+
"rtx2080": 7.5,
|
|
55
|
+
"t4": 7.5,
|
|
56
|
+
"v100": 7.0,
|
|
57
|
+
"p100": 6.0,
|
|
58
|
+
"p40": 6.1,
|
|
59
|
+
"p4": 6.1,
|
|
60
|
+
}
|
|
61
|
+
_ORDERED = sorted(_COMPUTE_CAP, key=len, reverse=True)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def compute_cap(gpu_name: str) -> Optional[float]:
|
|
65
|
+
"""The compute capability of a GPU model named like "NVIDIA H100 80GB HBM3"."""
|
|
66
|
+
key = re.sub(r"[\s_\-]+", "", (gpu_name or "").lower()).replace("nvidia", "").replace("geforce", "")
|
|
67
|
+
for needle in _ORDERED:
|
|
68
|
+
if needle in key:
|
|
69
|
+
return _COMPUTE_CAP[needle]
|
|
70
|
+
return None
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""A small JSON-over-HTTP client the RunPod and Lambda adapters share.
|
|
2
|
+
|
|
3
|
+
It retries what is safe to retry (a rate limit on any call, a gateway error
|
|
4
|
+
on a read) and turns transport failures into the normalized errors. Each
|
|
5
|
+
adapter's client classifies the provider's own error bodies.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import time
|
|
11
|
+
from typing import Any, Optional
|
|
12
|
+
|
|
13
|
+
import httpx
|
|
14
|
+
|
|
15
|
+
from .. import __version__
|
|
16
|
+
from ..core.errors import ProviderError, ProviderTimeoutError
|
|
17
|
+
|
|
18
|
+
# Waits between attempts on a rate limit or a transient gateway error.
|
|
19
|
+
RETRY_DELAYS_S = (2.0, 4.0, 8.0, 15.0, 15.0)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def retry_after(response: httpx.Response, default: float) -> float:
|
|
23
|
+
try:
|
|
24
|
+
return min(60.0, max(0.0, float(response.headers.get("Retry-After", default))))
|
|
25
|
+
except ValueError:
|
|
26
|
+
return default
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class JsonClient:
|
|
30
|
+
"""Bearer-authenticated JSON client. Subclasses set ``label``."""
|
|
31
|
+
|
|
32
|
+
label = "provider"
|
|
33
|
+
|
|
34
|
+
def __init__(
|
|
35
|
+
self,
|
|
36
|
+
api_key: str,
|
|
37
|
+
api_base: str,
|
|
38
|
+
timeout: float = 60.0,
|
|
39
|
+
client: Optional[httpx.Client] = None,
|
|
40
|
+
) -> None:
|
|
41
|
+
self.api_key = api_key
|
|
42
|
+
self.api_base = api_base.rstrip("/")
|
|
43
|
+
self.timeout = timeout
|
|
44
|
+
self._client = client
|
|
45
|
+
self.sleep = time.sleep
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def client(self) -> httpx.Client:
|
|
49
|
+
if self._client is None:
|
|
50
|
+
self._client = httpx.Client(
|
|
51
|
+
timeout=self.timeout,
|
|
52
|
+
headers={
|
|
53
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
54
|
+
"Accept": "application/json",
|
|
55
|
+
"Content-Type": "application/json",
|
|
56
|
+
"User-Agent": f"gpu4agents/{__version__}",
|
|
57
|
+
},
|
|
58
|
+
)
|
|
59
|
+
return self._client
|
|
60
|
+
|
|
61
|
+
def close(self) -> None:
|
|
62
|
+
if self._client is not None:
|
|
63
|
+
self._client.close()
|
|
64
|
+
self._client = None
|
|
65
|
+
|
|
66
|
+
def send(
|
|
67
|
+
self,
|
|
68
|
+
method: str,
|
|
69
|
+
url: str,
|
|
70
|
+
*,
|
|
71
|
+
json_body: Any = None,
|
|
72
|
+
params: Optional[dict] = None,
|
|
73
|
+
) -> httpx.Response:
|
|
74
|
+
"""The response after retries; status codes are left to the caller."""
|
|
75
|
+
if not url.startswith("http"):
|
|
76
|
+
url = f"{self.api_base}{url}"
|
|
77
|
+
response: Optional[httpx.Response] = None
|
|
78
|
+
for delay in (*RETRY_DELAYS_S, None):
|
|
79
|
+
try:
|
|
80
|
+
response = self.client.request(method, url, json=json_body, params=params)
|
|
81
|
+
except httpx.TimeoutException as exc:
|
|
82
|
+
raise ProviderTimeoutError(f"{self.label} timed out on {method} {url}") from exc
|
|
83
|
+
except httpx.HTTPError as exc:
|
|
84
|
+
raise ProviderError(f"{self.label} request failed ({method} {url}): {exc}") from exc
|
|
85
|
+
# A 429 was not processed, so any call can be resent; a 5xx only
|
|
86
|
+
# a read, since a create may have gone through.
|
|
87
|
+
transient = response.status_code == 429 or (
|
|
88
|
+
method == "GET" and response.status_code in (502, 503, 504)
|
|
89
|
+
)
|
|
90
|
+
if not transient or delay is None:
|
|
91
|
+
break
|
|
92
|
+
self.sleep(retry_after(response, delay))
|
|
93
|
+
assert response is not None
|
|
94
|
+
return response
|
|
95
|
+
|
|
96
|
+
@staticmethod
|
|
97
|
+
def body(response: httpx.Response) -> Any:
|
|
98
|
+
if not response.content:
|
|
99
|
+
return None
|
|
100
|
+
try:
|
|
101
|
+
return response.json()
|
|
102
|
+
except ValueError:
|
|
103
|
+
return None
|