NAME

WWW::VastAI - Perl client for the Vast.ai REST APIs

VERSION

version 0.001

SYNOPSIS

use WWW::VastAI;

my $vast = WWW::VastAI->new(
    api_key => $ENV{VAST_API_KEY},
);

my $offers = $vast->offers->search(
    limit    => 5,
    verified => { eq => \1 },
    rentable => { eq => \1 },
    rented   => { eq => \0 },
    gpu_name => { in => ['RTX_4090', 'RTX_5090'] },
);

my $instance = $offers->[0]->create_instance(
    image   => 'vastai/base-image:@vastai-automatic-tag',
    disk    => 32,
    runtype => 'ssh',
);

my $templates = $vast->templates->list(
    select_filters => { use_ssh => { eq => \1 } },
);

my $endpoints = $vast->endpoints->list;

DESCRIPTION

WWW::VastAI provides a Perl client for the Vast.ai REST APIs. It covers:

  • marketplace offer search

  • instance lifecycle and instance SSH/log helpers

  • templates

  • volumes

  • SSH keys, API keys, user profile, env vars

  • invoices (v1)

  • serverless endpoints, workergroups, logs and workers

The request routing is driven by a central operation map, following the same idea as OpenAPI-backed clients while keeping the distribution lightweight.

LIVE TESTING

The distribution ships with three optional live tests:

  • t/90-live-vastai.t - read-only, no-cost API coverage

  • t/91-live-vastai-cost.t - cost-incurring instance lifecycle test

  • t/92-live-vastai-volume.t - cost-incurring volume lifecycle test

These tests are skipped unless the corresponding environment variables are set. Use VAST_LIVE_TEST=1 for read-only live coverage and add VAST_LIVE_ALLOW_COST=1 to enable the instance and volume lifecycle tests.

SEE ALSO

WWW::VastAI::API::Offers, WWW::VastAI::API::Instances, WWW::VastAI::API::Templates, WWW::VastAI::API::Volumes, WWW::VastAI::API::Endpoints, WWW::VastAI::API::Workergroups

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-vastai/issues.

IRC

Join #kubernetes on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.