/vastai-pack:vastai-sdk-patterns [client-mode-resource-and-lifecycle-owner]from vastai-pack
Guides selection of Vast.ai Python client (high-level SDK, SyncClient, AsyncClient, or Serverless) and implements typed, bounded, ownership-safe GPU instance lifecycles with cleanup finalizers.
Ships in vastai-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use the highest-level client that preserves the required control. Keep resource identity and cleanup ownership explicit, normalize provider response variants at one boundary, and never hide a billable instance behind an unbounded retry.
Use VastAI for broad CLI-equivalent operations, SyncClient for typed synchronous instance control, AsyncClient inside an async context, or Serverless for endpoint inference.
Map provider dictionaries and error shapes into a small internal result type. Preserve offer ID, contract ID, status, price, and raw error code for diagnosis.
Search and score offers without creating resources. Require an approved plan object before calling create, update, destroy, or credit operations.
Persist the returned instance ID immediately, apply a monotonic deadline, classify terminal failure states, and place destroy or handoff in an explicit finalizer.
Cover 401, 403, 429, malformed responses, create-without-ID, readiness timeout, and cleanup failure using local fakes.
Return normalized decisions and state transitions; never return the API key or full environment.
Construct clients from VAST_API_KEY or the approved local configuration. Do not pass keys as literals, serialize client objects, or let provider credentials cross into workload payloads.
Use Read and Grep to inspect manifests, configuration, provider output, and existing tests before proposing a mutation. Use Write or Edit only for the approved plan, implementation, test, or redacted receipt; do not create, update, destroy, or fund Vast.ai resources without explicit operator approval.
Return client type, package version, plan identity, provider resource IDs, terminal outcome, and cleanup owner.
An async job runner uses AsyncClient as a context manager, records instance.id before waiting, cancels on its deadline, and destroys the instance in a tested finalizer.
| Failure | Response |
|---|---|
| Create succeeds without a usable ID | Stop follow-on work, reconcile instances from the account, and avoid a blind second create. |
| Response shape changes | Fail at the adapter boundary and retain the redacted raw response for review. |
| 429 occurs | Use bounded client retry and reduce polling; do not multiply retries at every layer. |
| Finalizer cannot destroy | Persist the resource ID and page the billing owner. |
What SKILL.md sets; muted values are Claude Code's defaults
inherithighThree short reads, in order
24 skills in this plugin
/vastai-ci-integrationRun a credential-safe disposable Vast.ai GPU CI job with a scoped key, immutable image, cost ceiling, terminal-state deadline, and guaranteed destruction. Use when GPU-only acceptance must run in CI. Trigger with: "run GPU tests in CI", "add Vast.ai to GitHub Actions", "make Vast.ai CI clean up"./vastai-common-errorsClassify Vast.ai authentication, offer, instance-state, SSH, image, credit, and API failures before choosing a recovery action. Use when automation is stuck or a GPU workload cannot start. Trigger with: "diagnose Vast.ai", "why is my instance scheduling", "fix a Vast.ai CLI error"./vastai-core-workflow-aAnalyze and execute a checkpointed Vast.ai training job from offer policy through artifact recovery and destruction. Use when a repeatable single-job GPU run needs budget and interruption controls. Trigger with: "run training on Vast.ai", "checkpoint a Vast.ai job", "recover Vast.ai training artifacts"./vastai-core-workflow-bBuild and roll out a Vast.ai Serverless endpoint with measured autoscaling, a canary template, and a zero-downtime worker update. Use when production inference capacity or model bytes change. Trigger with: "deploy Vast.ai Serverless", "tune a Vast.ai worker group", "roll a model without downtime"./vastai-cost-tuningReduce Vast.ai GPU, storage, and bandwidth spend without weakening workload requirements or leaving stopped resources billable. Use when selecting offers, setting spot policy, cleaning idle resources, or reconciling invoices. Trigger with: "optimize Vast.ai cost", "find Vast.ai cost leaks", "compare Vast.ai offers"./vastai-data-handlingManage datasets, checkpoints, models, and artifacts through Vast.ai instances, volumes, and cloud connections with integrity and teardown controls. Use when data must move to, from, or between Vast.ai resources. Trigger with: "copy data to Vast.ai", "protect Vast.ai checkpoints", "recover data before destroying an instance".npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin vastai-packOther plugins' skills for the same job