Help us shape the future of Go! Take the 2026 Go Developer Survey

hyperbolic

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

Hyperbolic

hyperbolic-go

Go Reference CI License

The official Go SDK for the Hyperbolic API. Use it to rent GPUs, manage storage volumes and SSH keys, and track your balance from Go.

The SDK is generated from Hyperbolic's published OpenAPI specification, so it covers the entire API and stays in step with it.

Requirements

  • Go 1.24 or later. CI tests the two most recent Go releases.
  • A Hyperbolic API key. Create one under Settings > API Keys in the dashboard.

Installation

go get github.com/HyperbolicLabs/hyperbolic-go

While the repository is private, tell Go not to look the module up in the public proxy and checksum database, and give Git read access with an SSH key or an HTTPS token (git config url."https://<token>@github.com/".insteadOf https://github.com/).

go env -w GOPRIVATE=github.com/HyperbolicLabs/*

Usage

Quick start

This program prints your balance and the virtual machines you can rent now. Neither call spends money.

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)

func main() {
	ctx := context.Background()
	client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
	if err != nil {
		log.Fatal(err)
	}

	balance, err := client.Balances.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("balance: $%.2f\n", balance.BalanceCents/100)

	options, err := client.Rentals.Options(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, o := range options {
		v, err := o.ValueByDiscriminator()
		if err != nil {
			continue // a machine type this version of the SDK does not know
		}
		if vm, ok := v.(hyperbolic.VirtualMachineOption); ok && vm.Enabled {
			fmt.Printf("%d x %s in %s: $%.2f/hour\n", vm.GPUCount, vm.GPUType, vm.Region, vm.CostPerHourCents/100)
		}
	}
}
Renting a GPU
created, err := client.Rentals.Create(ctx, hyperbolic.CreateRentalParams{
	RentalType: hyperbolic.RentalTypeVirtualMachine,
	GPUType:    hyperbolic.Ptr(hyperbolic.GPUTypeH100),
	GPUCount:   1,
	Region:     hyperbolic.Ptr("us-central-1"),
	Label:      hyperbolic.Ptr("train-run-42"),
})
if err != nil {
	return err // see "Retries and create safety" before retrying
}

// The API has no webhooks: poll until the rental is running.
found, err := client.Rentals.Get(ctx, hyperbolic.GetRentalParams{RentalID: created.RentalID})
if err != nil {
	return err
}
if active, err := found.AsActiveRentalLookup(); err == nil && active.Rental.Status == hyperbolic.RentalStatusRunning {
	for _, ep := range active.Rental.SSHEndpoints {
		fmt.Printf("ssh %s@%s -p %d\n", ep.User, ep.Host, ep.Port)
	}
}

// Stop paying.
if _, err := client.Rentals.Terminate(ctx, hyperbolic.TerminateRentalParams{RentalID: created.RentalID}); err != nil {
	return err
}

A rental is identified by its string RentalID. Money is in cents, including CostPerHour on a rental's current term.

Services

The client groups the API's operations into services named after the specification's tags.

Service Methods
Rentals Options, Create, Get, ListActive, ListHistory, HasHistory, ActiveSummary, Update, Terminate, RebootInstance, AttachSSHKey, DetachSSHKey, and reservations: ReserveOptions, RequestReservation, ConversionQuote, ConvertToReserved, ExtensionQuote, ExtendReserved
StorageVolumes Options, List, Create, Update, Attach, Terminate
SSHKeys List, ListForRental, Create, Update, Delete
Balances Get
APIKeys List
Users Me, UpdateMe, VerifyPhoneNumber, DeleteMe

Each method takes a context.Context and, when the operation has inputs, one ...Params struct. Its doc comment names the HTTP call it makes. Deprecated operations are left out.

Configuration

NewClient takes options.

client, err := hyperbolic.NewClient(apiKey,
	hyperbolic.WithUserAgent("my-scheduler/1.4.0"),
	hyperbolic.WithHTTPClient(&http.Client{Timeout: 10 * time.Second}),
	hyperbolic.WithRetryPolicy(hyperbolic.NoRetries()),
)
Option Default Use it to
WithBaseURL https://api.hyperbolic.ai Point the client at another endpoint, such as a test server.
WithHTTPClient An http.Client with a 30 second timeout Set your own transport, proxy or timeout.
WithUserAgent hyperbolic-go/<version> Name your application in the User-Agent header, ahead of the SDK's own token.
WithRetryPolicy DefaultRetryPolicy(), 3 attempts Tune retries, or turn them off with NoRetries().

The base URL must use https, except for loopback test servers, so an API key never crosses a network unencrypted. The key never appears in %v or %#v output.

Errors

Every API failure is an *hyperbolic.APIError with the HTTP status, the machine-readable Code, the message and the Issues the API listed. Helpers cover the common checks.

Helper True when
IsOutcomeUnknown(err) A call that is not safe to repeat may or may not have taken effect
IsNotFound(err) The object does not exist, including a lookup the API answered with null
IsUnauthorized(err) The API key was rejected
IsRateLimited(err) The request hit a rate limit. APIError.RetryAfter says how long to wait
HasCode(err, hyperbolic.CodeInsufficientBalance) The API returned that error code
Retries and create safety

Calls that are safe to repeat are retried on 429, 502, 503, 504 and transport errors, with exponential backoff and jitter, honoring Retry-After. If the server asks to wait longer than RetryPolicy.MaxDelay, the client returns the error instead of blocking, so a controller can requeue.

Creating a rental is not idempotent, and the API has no idempotency key. A create that fails after the server applied it, through a 5xx, a timeout or a dropped connection, would rent the GPUs twice if retried blindly. The client retries such a call only on a 429 or when the connection never opened, the two cases where the server provably did not process it. Any other failure returns an error matching ErrOutcomeUnknown.

created, err := client.Rentals.Create(ctx, params)
switch {
case errors.Is(err, hyperbolic.ErrOutcomeUnknown):
	// The rental may exist. Find it by label before creating another one.
	for r, err := range client.Rentals.ListActiveAll(ctx, hyperbolic.ListActiveRentalsParams{}) {
		...
	}
case err != nil:
	// Definite failure: nothing was created.
}

Set a Label you can recognize on every create so this lookup is possible. Which calls are safe to repeat is declared per operation in openapi/sdk.yaml and tested for each one.

Pagination

List operations that return pages also have an ...All method, a Go iterator over every item that fetches pages as it goes.

for r, err := range client.Rentals.ListActiveAll(ctx, hyperbolic.ListActiveRentalsParams{}) {
	if err != nil {
		return err
	}
	fmt.Println(r.RentalID, r.Status)
}
Types
  • Optional request fields are pointers. Set them with hyperbolic.Ptr(v).
  • Nullable response fields are nullable.Nullable[T]. Get() returns the value and IsNull() reports an explicit null.
  • Unions such as a rental's CurrentTerm have Discriminator(), ValueByDiscriminator() and an As... method per variant, such as AsOnDemandTerm.
  • Enums are typed strings with a constant per known value, such as RentalStatusRunning. A value the SDK does not know yet still decodes, and Valid() reports whether it is known.

Testing your code

hyperbolictest is an in-memory implementation of the API, generated from the same specification as the client. Use it instead of the real API in tests. It can inject the failures that matter.

srv := hyperbolictest.NewServer(t)
client := srv.Client(t)

// Make the next create fail with a 502 after the rental was created.
srv.InjectFault(hyperbolictest.Fault{
	Method: http.MethodPost, Path: hyperbolictest.PathRentals,
	Status: http.StatusBadGateway, AfterCommit: true,
})

It also simulates status changes with SetRentalStatus, rentals ended by the platform with TerminateExternally and low balances with SetBalance. It starts with one saved SSH key, and AddSSHKey and RentalSSHKeyIDs set up and check the keys a rental gets. It counts requests, so a test can assert that a create was sent exactly once. Operations it does not model answer 501. NewServer takes a testing.TB, so Ginkgo suites pass GinkgoTB().

Documentation

Versioning

hyperbolic-go follows semantic versioning. Before 1.0 a minor version may change the Go API. The release notes call out every breaking change, and its pull request says what to change. Each release is checked against the exported API of the previous one, so the version number reflects what changed. The two most recent Go releases are supported, following Go's release policy. RELEASE.md explains how releases are made.

Getting help

  • Report SDK bugs and feature requests by opening an issue.
  • For your account, billing or the API itself, contact Hyperbolic support at support@hyperbolic.ai or through the chat in the dashboard.
  • Report security vulnerabilities privately, as SECURITY.md describes, never in a public issue.

Contributing

Contributions are welcome. Most of the SDK is generated, so a change to its shape belongs in the specification, the overlay or the templates in openapi/ and internal/gen/, never in a _gen.go file. CONTRIBUTING.md explains the pipeline, the checks and the pull request process. Everyone taking part follows the Code of Conduct.

License

hyperbolic-go is licensed under the Apache License 2.0. Copyright Hyperbolic Labs, Inc.

Documentation

Overview

Package hyperbolic is the Go SDK for the Hyperbolic API.

Its operations and types are generated from the API's published OpenAPI spec (https://api.hyperbolic.ai/v2/openapi.json). A Client groups them by area: Client.Rentals, Client.StorageVolumes, Client.SSHKeys, Client.Balances, Client.APIKeys and Client.Users. Each method takes a context.Context and, when the operation has inputs, a ...Params struct.

Getting started

client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
if err != nil { ... }
created, err := client.Rentals.Create(ctx, hyperbolic.CreateRentalParams{
	RentalType: hyperbolic.RentalTypeVirtualMachine,
	GPUType:    hyperbolic.Ptr(hyperbolic.GPUTypeH100),
	GPUCount:   1,
})

Things the API does that are easy to get wrong

  • Creating a rental is not idempotent and the API has no idempotency key. See "Create safety" below.
  • A rental is identified by its string RentalID, which terminate, reboot and the lookup take.
  • Money is in cents, including CostPerHour on a rental's current term (3192 == $31.92/hr).
  • A create returns the rental without its live status. Status, instances and SSH endpoints come from RentalsService.Get or from listing.
  • There are no webhooks. Status is observed by polling.

Create safety

If a call that is not safe to repeat, such as creating a rental, fails in a way that leaves its outcome unknown (a 5xx response, a timeout, or a dropped connection after the request was sent), it may have taken effect even though it returned an error. The client never retries it in that situation. Instead it returns an error matching ErrOutcomeUnknown:

created, err := client.Rentals.Create(ctx, params)
if errors.Is(err, hyperbolic.ErrOutcomeUnknown) {
	// Look the rental up (for example by label) before trying again.
}

Calls that are safe to repeat are retried on transient failures according to the client's RetryPolicy. Calls the server provably did not process (HTTP 429, or a connection that was never made) are retried for every kind of call.

Types

Optional request fields are pointers. Set them with Ptr. Nullable response fields are nullable.Nullable values from github.com/oapi-codegen/nullable. Unions have a Discriminator method and an As method per variant. Enums are typed strings, and a value the SDK does not know yet still decodes.

Testing

Package hyperbolictest is an in-memory fake of the API with fault injection, for testing code that uses this package.

Example

Print the balance and the virtual machines that can be rented now. Neither call spends money. The README's quick start is this example.

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)

func main() {
	ctx := context.Background()
	client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
	if err != nil {
		log.Fatal(err)
	}

	balance, err := client.Balances.Get(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("balance: $%.2f\n", balance.BalanceCents/100)

	options, err := client.Rentals.Options(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, o := range options {
		v, err := o.ValueByDiscriminator()
		if err != nil {
			continue // a machine type this version of the SDK does not know
		}
		if vm, ok := v.(hyperbolic.VirtualMachineOption); ok && vm.Enabled {
			fmt.Printf("%d x %s in %s: $%.2f/hour\n", vm.GPUCount, vm.GPUType, vm.Region, vm.CostPerHourCents/100)
		}
	}
}

Index

Examples

Constants

View Source
const (
	CodeInsufficientBalance              = "INSUFFICIENT_BALANCE"
	CodeNoPublicKey                      = "NO_PUBLIC_KEY"
	CodeRegionDisabled                   = "REGION_DISABLED"
	CodeCustomPortsNotSupportedForRegion = "CUSTOM_PORTS_NOT_SUPPORTED_FOR_REGION"
	// CodeFailedToCalculateCostPerHour is what the API returns when no
	// offering matches the requested shape, fabric and region.
	CodeFailedToCalculateCostPerHour = "FAILED_TO_CALCULATE_COST_PER_HOUR"
	CodeRentalNotFound               = "RENTAL_NOT_FOUND"
	CodeAlreadyTerminated            = "ALREADY_TERMINATED"
	CodeNotFound                     = "NOT_FOUND"
	// The SSH key codes are documented by the spec. Saving a key the account
	// already has, with the same type and body, returns
	// SSH_PUBLIC_KEY_ALREADY_EXISTS. For deleting a key that a live rental
	// uses, the spec documents SSH_PUBLIC_KEY_IN_USE, but the live API
	// answers 409 with code CONFLICT, so check the status as well.
	CodeSSHPublicKeyAlreadyExists = "SSH_PUBLIC_KEY_ALREADY_EXISTS"
	CodeSSHPublicKeyInUse         = "SSH_PUBLIC_KEY_IN_USE"
	CodeSSHPublicKeyNotFound      = "SSH_PUBLIC_KEY_NOT_FOUND"
)

Error codes returned by the API. The first five were observed against the live API while building the operator prototype. RENTAL_NOT_FOUND and ALREADY_TERMINATED are handled defensively and still need confirming with the platform team.

View Source
const DefaultBaseURL = "https://api.hyperbolic.ai"

DefaultBaseURL is the production Hyperbolic API.

Variables

View Source
var ErrNotFound = errors.New("hyperbolic: not found")

ErrNotFound is returned (wrapped) when a requested object does not exist.

View Source
var ErrOutcomeUnknown = errors.New("hyperbolic: outcome unknown")

ErrOutcomeUnknown matches errors from non-idempotent calls (such as creating a rental) whose effect is unknown: the server may or may not have applied the request. Callers must look up the result before retrying.

Functions

func HasCode

func HasCode(err error, code string) bool

HasCode reports whether err carries the given API error code.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err means the object does not exist.

func IsOutcomeUnknown

func IsOutcomeUnknown(err error) bool

IsOutcomeUnknown is shorthand for errors.Is(err, ErrOutcomeUnknown).

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited reports whether the request was rejected by rate limiting.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized reports whether the API key was rejected.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v, for setting optional request fields:

params.Label = hyperbolic.Ptr("training")

func StatusCode

func StatusCode(err error) int

StatusCode returns the HTTP status of an API error, or 0.

Types

type APIError

type APIError struct {
	Method     string
	Path       string
	StatusCode int
	// Code is the machine-readable error code (for example
	// INSUFFICIENT_BALANCE), when the API provided one.
	Code    string
	Message string
	// Issues lists what the API said was wrong with the request, if anything.
	Issues []string
	// RetryAfter is the server's Retry-After hint, if any.
	RetryAfter time.Duration
	// Body is the raw response body, truncated.
	Body string
}

APIError is a non-2xx response from the API.

func (*APIError) Error

func (e *APIError) Error() string

type APIKey

type APIKey struct {
	CreatedAt time.Time                 `json:"createdAt"`
	Last4     string                    `json:"last4"`
	OrgID     nullable.Nullable[string] `json:"orgId"`

	// OrganizationMember The organization member an API key belongs to.
	OrganizationMember *OrganizationMember          `json:"organizationMember,omitempty"`
	PublicID           string                       `json:"publicId"`
	RevokedAt          nullable.Nullable[time.Time] `json:"revokedAt"`
	UserID             string                       `json:"userId"`
}

APIKey An issued API key. The secret itself is only ever returned at creation.

type APIKeysService

type APIKeysService struct {
	// contains filtered or unexported fields
}

APIKeysService lists the account's API keys.

func (*APIKeysService) List

func (s *APIKeysService) List(ctx context.Context) ([]APIKey, error)

List calls GET /v2/api-keys/list: list all API keys for the current user or organization.

type AccountBalance

type AccountBalance struct {
	BalanceCents      float64 `json:"balanceCents"`
	MaxOverdraftCents float64 `json:"maxOverdraftCents"`
}

AccountBalance The authenticated account's credit balance.

type ActiveRentalLookup

type ActiveRentalLookup struct {
	// Rental A GPU rental with its live status.
	Rental RentalWithStatus        `json:"rental"`
	State  ActiveRentalLookupState `json:"state"`
}

ActiveRentalLookup A rental lookup that found a running rental.

type ActiveRentalLookupState

type ActiveRentalLookupState string

ActiveRentalLookupState defines model for ActiveRentalLookup.State.

const (
	ActiveRentalLookupStateActive ActiveRentalLookupState = "active"
)

Defines values for ActiveRentalLookupState.

func (ActiveRentalLookupState) Valid

func (e ActiveRentalLookupState) Valid() bool

Valid indicates whether the value is a known member of the ActiveRentalLookupState enum.

type ActiveRentalSummary

type ActiveRentalSummary struct {
	// ByTermType Active rental totals for each term type.
	ByTermType       ActiveRentalSummaryByTermType `json:"byTermType"`
	CostPerHourCents int                           `json:"costPerHourCents"`
	Count            int                           `json:"count"`
}

ActiveRentalSummary How many rentals the caller has active, and their summed hourly cost in cents.

type ActiveRentalSummaryByTermType

type ActiveRentalSummaryByTermType struct {
	// OnDemand How many active rentals are on one term type, and their summed hourly cost in cents.
	OnDemand RentalTermTypeSummary `json:"on-demand"`

	// PrivateCloud How many active rentals are on one term type, and their summed hourly cost in cents.
	PrivateCloud RentalTermTypeSummary `json:"private-cloud"`

	// Reserved How many active rentals are on one term type, and their summed hourly cost in cents.
	Reserved RentalTermTypeSummary `json:"reserved"`
}

ActiveRentalSummaryByTermType Active rental totals for each term type.

type ActiveRentalsPage

type ActiveRentalsPage struct {
	Items      []RentalWithStatus `json:"items"`
	Page       int                `json:"page"`
	PageSize   int                `json:"pageSize"`
	Total      int                `json:"total"`
	TotalPages int                `json:"totalPages"`
}

ActiveRentalsPage One numbered page of active rentals, most recently started first.

type AttachSSHKeyParams

type AttachSSHKeyParams struct {
	RentalID       string `json:"rentalId"`
	SSHPublicKeyID int    `json:"sshPublicKeyId"`
}

AttachSSHKeyParams defines model for AttachSSHKeyParams.

type AttachStorageVolumeParams

type AttachStorageVolumeParams struct {
	RentalIds       []string `json:"rentalIds"`
	StorageVolumeID string   `json:"storageVolumeId"`
}

AttachStorageVolumeParams defines model for AttachStorageVolumeParams.

type AttachStorageVolumeResponse

type AttachStorageVolumeResponse struct {
	AttachedRentalIds []string `json:"attachedRentalIds"`
	Message           string   `json:"message"`
	StorageVolumeID   string   `json:"storageVolumeId"`
}

AttachStorageVolumeResponse Confirmation that a storage volume is being attached.

type AttachedStorage

type AttachedStorage struct {
	CostPerHourCents float64 `json:"costPerHourCents"`
	Label            string  `json:"label"`
	SizeInGb         int     `json:"sizeInGb"`
	StorageVolumeID  string  `json:"storageVolumeId"`
	VirtualIP        string  `json:"virtualIp"`
}

AttachedStorage A storage volume as seen from a rental it is attached to.

type BalancesService

type BalancesService struct {
	// contains filtered or unexported fields
}

BalancesService reads the account's credit balance.

func (*BalancesService) Get

Get calls GET /v2/customer/balance: get the current user or organization account's balance.

Get the current account's balance

type BareMetalOption

type BareMetalOption struct {
	ConnectionType   ConnectionType             `json:"connectionType"`
	CostPerHourCents float64                    `json:"costPerHourCents"`
	Enabled          bool                       `json:"enabled"`
	EthernetVariant  *EthernetVariant           `json:"ethernetVariant,omitempty"`
	GPUCount         int                        `json:"gpuCount"`
	GPUFormFactor    GPUFormFactor              `json:"gpuFormFactor"`
	GPUType          GPUType                    `json:"gpuType"`
	MachineType      BareMetalOptionMachineType `json:"machineType"`
	Nodes            []struct {
		CPUCount  int    `json:"cpuCount"`
		CPUModel  string `json:"cpuModel"`
		GPUCount  int    `json:"gpuCount"`
		RAMGb     int    `json:"ramGb"`
		StorageGb int    `json:"storageGb"`
	} `json:"nodes"`
	Region                  string `json:"region"`
	SupportsCustomPorts     bool   `json:"supportsCustomPorts"`
	SupportsMultipleSSHKeys bool   `json:"supportsMultipleSshKeys"`
	SupportsSSHKeyUpdates   bool   `json:"supportsSshKeyUpdates"`
	TotalAvailable          *int   `json:"totalAvailable,omitempty"`
}

BareMetalOption defines model for BareMetalOption.

type BareMetalOptionMachineType

type BareMetalOptionMachineType string

BareMetalOptionMachineType defines model for BareMetalOption.MachineType.

const (
	BareMetalOptionMachineTypeBareMetal BareMetalOptionMachineType = "bare-metal"
)

Defines values for BareMetalOptionMachineType.

func (BareMetalOptionMachineType) Valid

func (e BareMetalOptionMachineType) Valid() bool

Valid indicates whether the value is a known member of the BareMetalOptionMachineType enum.

type Client

type Client struct {

	// APIKeys lists the account's API keys.
	APIKeys *APIKeysService

	// Balances reads the account's credit balance.
	Balances *BalancesService

	// Rentals manages on-demand and reserved GPU rentals.
	Rentals *RentalsService

	// SSHKeys manages the SSH public keys saved on the account.
	SSHKeys *SSHKeysService

	// StorageVolumes manages network storage volumes and their attachments.
	StorageVolumes *StorageVolumesService

	// Users reads and updates the signed-in user.
	Users *UsersService
	// contains filtered or unexported fields
}

Client is a Hyperbolic API client. Create one with NewClient. It is safe for concurrent use. Each field groups related API operations.

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)

NewClient returns a client authenticated with apiKey. A few operations, such as listing rental options, work without a key. The rest need one.

func (*Client) GoString

func (c *Client) GoString() string

GoString keeps the API key out of %#v output.

func (*Client) String

func (c *Client) String() string

String keeps the API key out of logs when a Client is printed.

type ConnectionType

type ConnectionType string

ConnectionType defines model for ConnectionType.

const (
	ConnectionTypeEthernet   ConnectionType = "ethernet"
	ConnectionTypeInfiniband ConnectionType = "infiniband"
)

Defines values for ConnectionType.

func (ConnectionType) Valid

func (e ConnectionType) Valid() bool

Valid indicates whether the value is a known member of the ConnectionType enum.

type ConvertRentalToReservedParams

type ConvertRentalToReservedParams struct {
	ExpectedTotalPriceCents int    `json:"expectedTotalPriceCents"`
	RentalID                string `json:"rentalId"`
	TermPeriodDays          int    `json:"termPeriodDays"`
}

ConvertRentalToReservedParams defines model for ConvertRentalToReservedParams.

type CreateRentalParams

type CreateRentalParams struct {
	ConvertToOnDemandOnExpiry *bool `json:"convertToOnDemandOnExpiry,omitempty"`

	// CUDAVersion Bare metal only.
	CUDAVersion *CreateRentalParamsCUDAVersion `json:"cudaVersion,omitempty"`

	// CustomPorts Virtual machines only.
	CustomPorts        *[]int   `json:"customPorts,omitempty"`
	DiscountPercentage *float64 `json:"discountPercentage,omitempty"`

	// GPUCount GPUs to rent. Bare metal rents whole nodes, so a multiple of 8.
	GPUCount          int      `json:"gpuCount"`
	GPUType           *GPUType `json:"gpuType,omitempty"`
	Label             *string  `json:"label,omitempty"`
	MonitoringEnabled *bool    `json:"monitoringEnabled,omitempty"`

	// NetworkType Required for bare metal. Virtual machines default to `ethernet`.
	NetworkType *CreateRentalParamsNetworkType `json:"networkType,omitempty"`

	// Region A region that offers the chosen machine type.
	Region     *string    `json:"region,omitempty"`
	RentalType RentalType `json:"rentalType"`

	// SSHPublicKeyID The saved SSH key to authorize on the rental. Defaults to the most recently added key.
	SSHPublicKeyID *int `json:"sshPublicKeyId,omitempty"`

	// SSHPublicKeyIds The saved SSH keys to authorize on the rental.
	SSHPublicKeyIds *[]int `json:"sshPublicKeyIds,omitempty"`

	// StorageVolume Bare metal only.
	StorageVolume  *StorageVolumeChoice `json:"storageVolume,omitempty"`
	TermPeriodDays *int                 `json:"termPeriodDays,omitempty"`
	TermType       *TermType            `json:"termType,omitempty"`
}

CreateRentalParams defines model for CreateRentalParams.

type CreateRentalParamsCUDAVersion

type CreateRentalParamsCUDAVersion string

CreateRentalParamsCUDAVersion Bare metal only.

const (
	CreateRentalParamsCUDAVersionCuda128 CreateRentalParamsCUDAVersion = "cuda12.8"
	CreateRentalParamsCUDAVersionCuda129 CreateRentalParamsCUDAVersion = "cuda12.9"
)

Defines values for CreateRentalParamsCUDAVersion.

func (CreateRentalParamsCUDAVersion) Valid

Valid indicates whether the value is a known member of the CreateRentalParamsCUDAVersion enum.

type CreateRentalParamsNetworkType

type CreateRentalParamsNetworkType string

CreateRentalParamsNetworkType Required for bare metal. Virtual machines default to `ethernet`.

const (
	CreateRentalParamsNetworkTypeEthernet   CreateRentalParamsNetworkType = "ethernet"
	CreateRentalParamsNetworkTypeInfiniband CreateRentalParamsNetworkType = "infiniband"
)

Defines values for CreateRentalParamsNetworkType.

func (CreateRentalParamsNetworkType) Valid

Valid indicates whether the value is a known member of the CreateRentalParamsNetworkType enum.

type CreateSSHKeyParams

type CreateSSHKeyParams struct {
	Name      *string `json:"name,omitempty"`
	PublicKey string  `json:"publicKey"`
}

CreateSSHKeyParams defines model for CreateSSHKeyParams.

type CreateStorageVolumeParams

type CreateStorageVolumeParams struct {
	Label     string    `json:"label"`
	Region    string    `json:"region"`
	RentalIds *[]string `json:"rentalIds,omitempty"`
	SizeInGb  int       `json:"sizeInGb"`
}

CreateStorageVolumeParams defines model for CreateStorageVolumeParams.

type CreatedStorageVolume

type CreatedStorageVolume struct {
	AttachedRentalIds []string            `json:"attachedRentalIds"`
	Label             string              `json:"label"`
	Message           string              `json:"message"`
	Region            string              `json:"region"`
	SizeInGb          int                 `json:"sizeInGb"`
	Status            StorageVolumeStatus `json:"status"`
	StorageVolumeID   string              `json:"storageVolumeId"`
}

CreatedStorageVolume A newly created storage volume.

type CurrentUser

type CurrentUser struct {
	CompletedPromos     []string                     `json:"completedPromos"`
	CreatedAt           time.Time                    `json:"createdAt"`
	Email               string                       `json:"email"`
	EmailVerified       nullable.Nullable[bool]      `json:"emailVerified"`
	HasPurchasedCredits bool                         `json:"hasPurchasedCredits"`
	ID                  string                       `json:"id"`
	IsActive            nullable.Nullable[bool]      `json:"isActive"`
	Name                nullable.Nullable[string]    `json:"name"`
	OnboardedAt         nullable.Nullable[time.Time] `json:"onboardedAt"`
	OnboardedFor        nullable.Nullable[string]    `json:"onboardedFor"`
	Picture             nullable.Nullable[string]    `json:"picture"`
	Provider            nullable.Nullable[string]    `json:"provider"`
	ReferralCode        nullable.Nullable[string]    `json:"referralCode"`
	ReservedRentalLimit *int                         `json:"reservedRentalLimit,omitempty"`
	Role                CurrentUserRole              `json:"role"`
}

CurrentUser The authenticated user, with account state resolved.

type CurrentUserRole

type CurrentUserRole string

CurrentUserRole defines model for CurrentUser.Role.

const (
	CurrentUserRoleElite CurrentUserRole = "elite"
	CurrentUserRolePro   CurrentUserRole = "pro"
	CurrentUserRoleUser  CurrentUserRole = "user"
)

Defines values for CurrentUserRole.

func (CurrentUserRole) Valid

func (e CurrentUserRole) Valid() bool

Valid indicates whether the value is a known member of the CurrentUserRole enum.

type DeleteSSHKeyParams

type DeleteSSHKeyParams struct {
	ID int `json:"id"`
}

DeleteSSHKeyParams defines model for DeleteSSHKeyParams.

type DeletedSSHKey

type DeletedSSHKey struct {
	ID int `json:"id"`
}

DeletedSSHKey The id of the SSH public key that was deleted.

type DetachSSHKeyParams

type DetachSSHKeyParams struct {
	RentalID       string `json:"rentalId"`
	SSHPublicKeyID int    `json:"sshPublicKeyId"`
}

DetachSSHKeyParams defines model for DetachSSHKeyParams.

type EthernetVariant

type EthernetVariant string

EthernetVariant defines model for EthernetVariant.

const (
	EthernetVariantNormal EthernetVariant = "normal"
	EthernetVariantRocev2 EthernetVariant = "rocev2"
)

Defines values for EthernetVariant.

func (EthernetVariant) Valid

func (e EthernetVariant) Valid() bool

Valid indicates whether the value is a known member of the EthernetVariant enum.

type ExistingStorageVolume

type ExistingStorageVolume struct {
	ID    string                     `json:"id"`
	IsNew ExistingStorageVolumeIsNew `json:"isNew"`
}

ExistingStorageVolume defines model for ExistingStorageVolume.

type ExistingStorageVolumeIsNew

type ExistingStorageVolumeIsNew bool

ExistingStorageVolumeIsNew defines model for ExistingStorageVolume.IsNew.

const (
	ExistingStorageVolumeIsNewFalse ExistingStorageVolumeIsNew = false
)

Defines values for ExistingStorageVolumeIsNew.

func (ExistingStorageVolumeIsNew) Valid

func (e ExistingStorageVolumeIsNew) Valid() bool

Valid indicates whether the value is a known member of the ExistingStorageVolumeIsNew enum.

type ExtendReservedRentalParams

type ExtendReservedRentalParams struct {
	ExpectedReservedUntil   time.Time `json:"expectedReservedUntil"`
	ExpectedTotalPriceCents int       `json:"expectedTotalPriceCents"`
	RentalID                string    `json:"rentalId"`
	TermPeriodDays          int       `json:"termPeriodDays"`
}

ExtendReservedRentalParams defines model for ExtendReservedRentalParams.

type GPUFormFactor

type GPUFormFactor string

GPUFormFactor defines model for GPUFormFactor.

const (
	GPUFormFactorPCIE GPUFormFactor = "pcie"
	GPUFormFactorSxm5 GPUFormFactor = "sxm5"
	GPUFormFactorSxm6 GPUFormFactor = "sxm6"
)

Defines values for GPUFormFactor.

func (GPUFormFactor) Valid

func (e GPUFormFactor) Valid() bool

Valid indicates whether the value is a known member of the GPUFormFactor enum.

type GPUType

type GPUType string

GPUType defines model for GPUType.

const (
	GPUTypeB200       GPUType = "b200"
	GPUTypeH100       GPUType = "h100"
	GPUTypeH200       GPUType = "h200"
	GPUTypeRtx6000Pro GPUType = "rtx-6000-pro"
)

Defines values for GPUType.

func (GPUType) Valid

func (e GPUType) Valid() bool

Valid indicates whether the value is a known member of the GPUType enum.

type GetRentalParams

type GetRentalParams struct {
	// RentalID The rental's `rentalId`.
	RentalID string `form:"rentalId" json:"rentalId"`
}

GetRentalParams defines parameters for GetRental.

type GetReservationExtensionQuoteParams

type GetReservationExtensionQuoteParams struct {
	RentalID       string `form:"rentalId" json:"rentalId"`
	TermPeriodDays *int   `form:"termPeriodDays,omitempty" json:"termPeriodDays,omitempty"`
}

GetReservationExtensionQuoteParams defines parameters for GetReservationExtensionQuote.

type GetReservedConversionQuoteParams

type GetReservedConversionQuoteParams struct {
	RentalID string `form:"rentalId" json:"rentalId"`
}

GetReservedConversionQuoteParams defines parameters for GetReservedConversionQuote.

type HasRentalHistoryParams

type HasRentalHistoryParams struct {
	IncludePrivateCloud *bool `form:"includePrivateCloud,omitempty" json:"includePrivateCloud,omitempty"`
}

HasRentalHistoryParams defines parameters for HasRentalHistory.

type HistoricalRental

type HistoricalRental struct {
	AttachedStorage           []AttachedStorage       `json:"attachedStorage"`
	ConnectionType            ConnectionType          `json:"connectionType"`
	ConvertToOnDemandOnExpiry nullable.Nullable[bool] `json:"convertToOnDemandOnExpiry"`
	CreatedAt                 time.Time               `json:"createdAt"`

	// CreatedBy The user who created a rental.
	CreatedBy               RentalCreator                        `json:"createdBy"`
	CurrentTerm             RentalTerm                           `json:"currentTerm"`
	EthernetVariant         nullable.Nullable[EthernetVariant]   `json:"ethernetVariant"`
	ExposedPorts            []int                                `json:"exposedPorts"`
	GPUCount                int                                  `json:"gpuCount"`
	GPUFormFactor           GPUFormFactor                        `json:"gpuFormFactor"`
	GPUType                 GPUType                              `json:"gpuType"`
	Label                   nullable.Nullable[string]            `json:"label"`
	ManagedCluster          nullable.Nullable[ManagedClusterRef] `json:"managedCluster"`
	MonitoringEnabled       bool                                 `json:"monitoringEnabled"`
	Name                    nullable.Nullable[string]            `json:"name"`
	NetworkInterfaces       []NetworkInterface                   `json:"networkInterfaces"`
	Nodes                   []RentalNode                         `json:"nodes"`
	OrgID                   nullable.Nullable[string]            `json:"orgId"`
	PortMappings            []PortMapping                        `json:"portMappings"`
	PrivateCluster          nullable.Nullable[PrivateCluster]    `json:"privateCluster"`
	Region                  string                               `json:"region"`
	RentalID                string                               `json:"rentalId"`
	RentalType              RentalType                           `json:"rentalType"`
	SSHEndpoints            []SSHEndpoint                        `json:"sshEndpoints"`
	StartedAt               nullable.Nullable[time.Time]         `json:"startedAt"`
	Status                  RentalStatus                         `json:"status"`
	SupportsAttachedStorage bool                                 `json:"supportsAttachedStorage"`
	SupportsCustomPorts     bool                                 `json:"supportsCustomPorts"`
	SupportsMultipleSSHKeys bool                                 `json:"supportsMultipleSshKeys"`
	SupportsPortForwarding  bool                                 `json:"supportsPortForwarding"`
	SupportsSSHKeyUpdates   bool                                 `json:"supportsSshKeyUpdates"`
	TerminatedAt            time.Time                            `json:"terminatedAt"`
	TerminationReason       nullable.Nullable[string]            `json:"terminationReason"`
	TotalCost               float64                              `json:"totalCost"`
	UpdatedAt               nullable.Nullable[time.Time]         `json:"updatedAt"`
	UserID                  string                               `json:"userId"`
}

HistoricalRental A GPU rental that has ended, with its total cost.

type ListActiveRentalsParams

type ListActiveRentalsParams struct {
	Page                *int        `form:"page,omitempty" json:"page,omitempty"`
	PageSize            *int        `form:"pageSize,omitempty" json:"pageSize,omitempty"`
	GPUType             *GPUType    `form:"gpuType,omitempty" json:"gpuType,omitempty"`
	Region              *string     `form:"region,omitempty" json:"region,omitempty"`
	TermType            *TermType   `form:"termType,omitempty" json:"termType,omitempty"`
	IncludePrivateCloud *bool       `form:"includePrivateCloud,omitempty" json:"includePrivateCloud,omitempty"`
	RentalType          *RentalType `form:"rentalType,omitempty" json:"rentalType,omitempty"`
	IncludeClusterPools *bool       `form:"includeClusterPools,omitempty" json:"includeClusterPools,omitempty"`
}

ListActiveRentalsParams defines parameters for ListActiveRentals.

type ListRentalHistoryParams

type ListRentalHistoryParams struct {
	Cursor              *string     `form:"cursor,omitempty" json:"cursor,omitempty"`
	Limit               *int        `form:"limit,omitempty" json:"limit,omitempty"`
	GPUType             *GPUType    `form:"gpuType,omitempty" json:"gpuType,omitempty"`
	Region              *string     `form:"region,omitempty" json:"region,omitempty"`
	TermType            *TermType   `form:"termType,omitempty" json:"termType,omitempty"`
	IncludePrivateCloud *bool       `form:"includePrivateCloud,omitempty" json:"includePrivateCloud,omitempty"`
	RentalType          *RentalType `form:"rentalType,omitempty" json:"rentalType,omitempty"`
}

ListRentalHistoryParams defines parameters for ListRentalHistory.

type ListRentalSSHKeysParams

type ListRentalSSHKeysParams struct {
	RentalID string `form:"rentalId" json:"rentalId"`
}

ListRentalSSHKeysParams defines parameters for ListRentalSSHKeys.

type ListReserveOptionsParams

type ListReserveOptionsParams struct {
	TermPeriodDays *int `form:"termPeriodDays,omitempty" json:"termPeriodDays,omitempty"`
}

ListReserveOptionsParams defines parameters for ListReserveOptions.

type ManagedClusterRef

type ManagedClusterRef struct {
	Label nullable.Nullable[string] `json:"label"`
	Name  string                    `json:"name"`
}

ManagedClusterRef The managed Kubernetes cluster a rental is a node pool of.

type NetworkInterface

type NetworkInterface struct {
	PrivateIP string `json:"privateIp"`
	PublicIP  string `json:"publicIp"`
}

NetworkInterface The public and private addresses of one node of a rental.

type NewStorageVolume

type NewStorageVolume struct {
	IsNew    NewStorageVolumeIsNew `json:"isNew"`
	Label    string                `json:"label"`
	SizeInGb int                   `json:"sizeInGb"`
}

NewStorageVolume defines model for NewStorageVolume.

type NewStorageVolumeIsNew

type NewStorageVolumeIsNew bool

NewStorageVolumeIsNew defines model for NewStorageVolume.IsNew.

const (
	NewStorageVolumeIsNewTrue NewStorageVolumeIsNew = true
)

Defines values for NewStorageVolumeIsNew.

func (NewStorageVolumeIsNew) Valid

func (e NewStorageVolumeIsNew) Valid() bool

Valid indicates whether the value is a known member of the NewStorageVolumeIsNew enum.

type OnDemandTerm

type OnDemandTerm struct {
	CostPerHour         float64                `json:"costPerHour"`
	DiscountPercentage  nullable.Nullable[any] `json:"discountPercentage"`
	EffectiveAt         time.Time              `json:"effectiveAt"`
	OriginalCostPerHour nullable.Nullable[any] `json:"originalCostPerHour"`
	ReservationEndsAt   nullable.Nullable[any] `json:"reservationEndsAt"`
	ReservedUntil       nullable.Nullable[any] `json:"reservedUntil"`
	TermPeriodDays      nullable.Nullable[any] `json:"termPeriodDays"`
	TermType            OnDemandTermTermType   `json:"termType"`
}

OnDemandTerm defines model for OnDemandTerm.

type OnDemandTermTermType

type OnDemandTermTermType string

OnDemandTermTermType defines model for OnDemandTerm.TermType.

const (
	OnDemandTermTermTypeOnDemand OnDemandTermTermType = "on-demand"
)

Defines values for OnDemandTermTermType.

func (OnDemandTermTermType) Valid

func (e OnDemandTermTermType) Valid() bool

Valid indicates whether the value is a known member of the OnDemandTermTermType enum.

type Option

type Option func(*transport) error

Option configures a Client.

func WithBaseURL

func WithBaseURL(raw string) Option

WithBaseURL points the client at a different API endpoint, for example a staging environment or a test server. Plain http is accepted only for loopback hosts, so an API key is never sent unencrypted over a network.

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient replaces the underlying HTTP client (for custom transports, proxies or timeouts). The default has a 30 second timeout.

func WithRetryPolicy

func WithRetryPolicy(p RetryPolicy) Option

WithRetryPolicy overrides the default RetryPolicy.

func WithUserAgent

func WithUserAgent(product string) Option

WithUserAgent prepends a product token to the User-Agent header, for example "hyperbolic-operator/0.1.0". The SDK's own token is always kept.

type OrganizationMember

type OrganizationMember struct {
	Email    string                 `json:"email"`
	FullName *string                `json:"fullName,omitempty"`
	ImageURL *string                `json:"imageUrl,omitempty"`
	Role     OrganizationMemberRole `json:"role"`
}

OrganizationMember The organization member an API key belongs to.

type OrganizationMemberRole

type OrganizationMemberRole string

OrganizationMemberRole defines model for OrganizationMember.Role.

const (
	OrganizationMemberRoleOrgAdmin  OrganizationMemberRole = "org:admin"
	OrganizationMemberRoleOrgMember OrganizationMemberRole = "org:member"
)

Defines values for OrganizationMemberRole.

func (OrganizationMemberRole) Valid

func (e OrganizationMemberRole) Valid() bool

Valid indicates whether the value is a known member of the OrganizationMemberRole enum.

type OutcomeUnknownError

type OutcomeUnknownError struct {
	Method string
	Path   string
	Err    error
}

OutcomeUnknownError wraps the underlying failure of a non-idempotent call whose effect is unknown. It matches ErrOutcomeUnknown with errors.Is.

func (*OutcomeUnknownError) Error

func (e *OutcomeUnknownError) Error() string

func (*OutcomeUnknownError) Is

func (e *OutcomeUnknownError) Is(target error) bool

Is reports whether target is ErrOutcomeUnknown.

func (*OutcomeUnknownError) Unwrap

func (e *OutcomeUnknownError) Unwrap() error

type PortMapping

type PortMapping struct {
	ExternalPort int `json:"externalPort"`
	InternalPort int `json:"internalPort"`
}

PortMapping A port reachable from outside, and the port it reaches inside the machine.

type PrivateCloudTerm

type PrivateCloudTerm struct {
	CostPerHour         float64                  `json:"costPerHour"`
	DiscountPercentage  nullable.Nullable[any]   `json:"discountPercentage"`
	EffectiveAt         time.Time                `json:"effectiveAt"`
	OriginalCostPerHour nullable.Nullable[any]   `json:"originalCostPerHour"`
	ReservationEndsAt   nullable.Nullable[any]   `json:"reservationEndsAt"`
	ReservedUntil       nullable.Nullable[any]   `json:"reservedUntil"`
	TermPeriodDays      nullable.Nullable[any]   `json:"termPeriodDays"`
	TermType            PrivateCloudTermTermType `json:"termType"`
}

PrivateCloudTerm defines model for PrivateCloudTerm.

type PrivateCloudTermTermType

type PrivateCloudTermTermType string

PrivateCloudTermTermType defines model for PrivateCloudTerm.TermType.

const (
	PrivateCloudTermTermTypePrivateCloud PrivateCloudTermTermType = "private-cloud"
)

Defines values for PrivateCloudTermTermType.

func (PrivateCloudTermTermType) Valid

func (e PrivateCloudTermTermType) Valid() bool

Valid indicates whether the value is a known member of the PrivateCloudTermTermType enum.

type PrivateCluster

type PrivateCluster struct {
	GPUModel nullable.Nullable[string]  `json:"gpuModel"`
	Handover map[string]interface{}     `json:"handover"`
	Location nullable.Nullable[string]  `json:"location"`
	Nodes    []PrivateClusterNode       `json:"nodes"`
	SSHPort  nullable.Nullable[float64] `json:"sshPort"`
	SSHUser  string                     `json:"sshUser"`
}

PrivateCluster The topology of a dedicated private cluster.

type PrivateClusterNode

type PrivateClusterNode struct {
	Hostname  nullable.Nullable[string] `json:"hostname"`
	PrivateIP string                    `json:"privateIp"`
	PublicIP  nullable.Nullable[string] `json:"publicIp"`
	Role      PrivateClusterNodeRole    `json:"role"`
}

PrivateClusterNode One machine of a dedicated private cluster.

type PrivateClusterNodeRole

type PrivateClusterNodeRole string

PrivateClusterNodeRole defines model for PrivateClusterNode.Role.

const (
	PrivateClusterNodeRoleCompute PrivateClusterNodeRole = "compute"
	PrivateClusterNodeRoleHead    PrivateClusterNodeRole = "head"
	PrivateClusterNodeRoleLogin   PrivateClusterNodeRole = "login"
)

Defines values for PrivateClusterNodeRole.

func (PrivateClusterNodeRole) Valid

func (e PrivateClusterNodeRole) Valid() bool

Valid indicates whether the value is a known member of the PrivateClusterNodeRole enum.

type RebootRentalInstanceParams

type RebootRentalInstanceParams struct {
	InstanceRef string `json:"instanceRef"`
	RentalID    string `json:"rentalId"`
}

RebootRentalInstanceParams defines model for RebootRentalInstanceParams.

type Rental

type Rental struct {
	AttachedStorage           []AttachedStorage       `json:"attachedStorage"`
	ConnectionType            ConnectionType          `json:"connectionType"`
	ConvertToOnDemandOnExpiry nullable.Nullable[bool] `json:"convertToOnDemandOnExpiry"`
	CreatedAt                 time.Time               `json:"createdAt"`

	// CreatedBy The user who created a rental.
	CreatedBy               RentalCreator                        `json:"createdBy"`
	CurrentTerm             RentalTerm                           `json:"currentTerm"`
	EthernetVariant         nullable.Nullable[EthernetVariant]   `json:"ethernetVariant"`
	ExposedPorts            []int                                `json:"exposedPorts"`
	GPUCount                int                                  `json:"gpuCount"`
	GPUFormFactor           GPUFormFactor                        `json:"gpuFormFactor"`
	GPUType                 GPUType                              `json:"gpuType"`
	Label                   nullable.Nullable[string]            `json:"label"`
	ManagedCluster          nullable.Nullable[ManagedClusterRef] `json:"managedCluster"`
	MonitoringEnabled       bool                                 `json:"monitoringEnabled"`
	Name                    nullable.Nullable[string]            `json:"name"`
	NetworkInterfaces       []NetworkInterface                   `json:"networkInterfaces"`
	Nodes                   []RentalNode                         `json:"nodes"`
	OrgID                   nullable.Nullable[string]            `json:"orgId"`
	PortMappings            []PortMapping                        `json:"portMappings"`
	PrivateCluster          nullable.Nullable[PrivateCluster]    `json:"privateCluster"`
	Region                  string                               `json:"region"`
	RentalID                string                               `json:"rentalId"`
	RentalType              RentalType                           `json:"rentalType"`
	SSHEndpoints            []SSHEndpoint                        `json:"sshEndpoints"`
	StartedAt               nullable.Nullable[time.Time]         `json:"startedAt"`
	SupportsAttachedStorage bool                                 `json:"supportsAttachedStorage"`
	SupportsCustomPorts     bool                                 `json:"supportsCustomPorts"`
	SupportsMultipleSSHKeys bool                                 `json:"supportsMultipleSshKeys"`
	SupportsPortForwarding  bool                                 `json:"supportsPortForwarding"`
	SupportsSSHKeyUpdates   bool                                 `json:"supportsSshKeyUpdates"`
	TerminatedAt            nullable.Nullable[time.Time]         `json:"terminatedAt"`
	TerminationReason       nullable.Nullable[string]            `json:"terminationReason"`
	UpdatedAt               nullable.Nullable[time.Time]         `json:"updatedAt"`
	UserID                  string                               `json:"userId"`
}

Rental A GPU rental.

type RentalCreator

type RentalCreator struct {
	Email   string                    `json:"email"`
	ID      string                    `json:"id"`
	Name    nullable.Nullable[string] `json:"name"`
	Picture nullable.Nullable[string] `json:"picture"`
}

RentalCreator The user who created a rental.

type RentalHistoryPage

type RentalHistoryPage struct {
	Items      []HistoricalRental        `json:"items"`
	NextCursor nullable.Nullable[string] `json:"nextCursor"`
	TotalCount nullable.Nullable[int]    `json:"totalCount"`
}

RentalHistoryPage One page of past rentals, most recently terminated first. Pass `nextCursor` back as `cursor` for the next page; it is `null` on the last page. `totalCount` is set on the first page only.

type RentalInstance

type RentalInstance struct {
	// ActualResources The hardware one node actually booted with, as its host reported it.
	ActualResources *RentalInstanceResources  `json:"actualResources,omitempty"`
	InstanceRef     string                    `json:"instanceRef"`
	InternalIP      nullable.Nullable[string] `json:"internalIp"`
	Phase           string                    `json:"phase"`
	SSH             nullable.Nullable[string] `json:"ssh"`
	SupportsReboot  bool                      `json:"supportsReboot"`
}

RentalInstance The live state of one node of a running rental.

type RentalInstanceReboot

type RentalInstanceReboot struct {
	InstanceRef string `json:"instanceRef"`
	Message     string `json:"message"`
	RentalID    string `json:"rentalId"`
}

RentalInstanceReboot Confirmation that a node of a rental is rebooting.

type RentalInstanceResources

type RentalInstanceResources struct {
	GPUCount         int      `json:"gpuCount"`
	GPUMemoryGb      *int     `json:"gpuMemoryGb,omitempty"`
	GPUModel         *string  `json:"gpuModel,omitempty"`
	NumaNodes        *float64 `json:"numaNodes,omitempty"`
	RAMGb            int      `json:"ramGb"`
	ScratchDiskCount *int     `json:"scratchDiskCount,omitempty"`
	ScratchDiskGb    *int     `json:"scratchDiskGb,omitempty"`
	VcpuCount        int      `json:"vcpuCount"`
}

RentalInstanceResources The hardware one node actually booted with, as its host reported it.

type RentalLookup

type RentalLookup struct {
	// contains filtered or unexported fields
}

RentalLookup defines model for RentalLookup.

func (RentalLookup) AsActiveRentalLookup

func (t RentalLookup) AsActiveRentalLookup() (ActiveRentalLookup, error)

AsActiveRentalLookup returns the union data inside the RentalLookup as a ActiveRentalLookup

func (RentalLookup) AsTerminatedRentalLookup

func (t RentalLookup) AsTerminatedRentalLookup() (TerminatedRentalLookup, error)

AsTerminatedRentalLookup returns the union data inside the RentalLookup as a TerminatedRentalLookup

func (RentalLookup) Discriminator

func (t RentalLookup) Discriminator() (string, error)

func (*RentalLookup) FromActiveRentalLookup

func (t *RentalLookup) FromActiveRentalLookup(v ActiveRentalLookup) error

FromActiveRentalLookup overwrites any union data inside the RentalLookup as the provided ActiveRentalLookup

func (*RentalLookup) FromTerminatedRentalLookup

func (t *RentalLookup) FromTerminatedRentalLookup(v TerminatedRentalLookup) error

FromTerminatedRentalLookup overwrites any union data inside the RentalLookup as the provided TerminatedRentalLookup

func (RentalLookup) MarshalJSON

func (t RentalLookup) MarshalJSON() ([]byte, error)

func (*RentalLookup) MergeActiveRentalLookup

func (t *RentalLookup) MergeActiveRentalLookup(v ActiveRentalLookup) error

MergeActiveRentalLookup performs a merge with any union data inside the RentalLookup, using the provided ActiveRentalLookup

func (*RentalLookup) MergeTerminatedRentalLookup

func (t *RentalLookup) MergeTerminatedRentalLookup(v TerminatedRentalLookup) error

MergeTerminatedRentalLookup performs a merge with any union data inside the RentalLookup, using the provided TerminatedRentalLookup

func (*RentalLookup) UnmarshalJSON

func (t *RentalLookup) UnmarshalJSON(b []byte) error

func (RentalLookup) ValueByDiscriminator

func (t RentalLookup) ValueByDiscriminator() (interface{}, error)

type RentalNode

type RentalNode struct {
	CPUCount  nullable.Nullable[float64] `json:"cpuCount"`
	CPUModel  string                     `json:"cpuModel"`
	GPUCount  int                        `json:"gpuCount"`
	RAMGb     int                        `json:"ramGb"`
	StorageGb int                        `json:"storageGb"`
	VcpuCount nullable.Nullable[float64] `json:"vcpuCount"`
}

RentalNode Hardware of one node of a rental, normalised across machine types.

type RentalOption

type RentalOption struct {
	// contains filtered or unexported fields
}

RentalOption defines model for RentalOption.

func (RentalOption) AsBareMetalOption

func (t RentalOption) AsBareMetalOption() (BareMetalOption, error)

AsBareMetalOption returns the union data inside the RentalOption as a BareMetalOption

func (RentalOption) AsVirtualMachineOption

func (t RentalOption) AsVirtualMachineOption() (VirtualMachineOption, error)

AsVirtualMachineOption returns the union data inside the RentalOption as a VirtualMachineOption

func (RentalOption) Discriminator

func (t RentalOption) Discriminator() (string, error)

func (*RentalOption) FromBareMetalOption

func (t *RentalOption) FromBareMetalOption(v BareMetalOption) error

FromBareMetalOption overwrites any union data inside the RentalOption as the provided BareMetalOption

func (*RentalOption) FromVirtualMachineOption

func (t *RentalOption) FromVirtualMachineOption(v VirtualMachineOption) error

FromVirtualMachineOption overwrites any union data inside the RentalOption as the provided VirtualMachineOption

func (RentalOption) MarshalJSON

func (t RentalOption) MarshalJSON() ([]byte, error)

func (*RentalOption) MergeBareMetalOption

func (t *RentalOption) MergeBareMetalOption(v BareMetalOption) error

MergeBareMetalOption performs a merge with any union data inside the RentalOption, using the provided BareMetalOption

func (*RentalOption) MergeVirtualMachineOption

func (t *RentalOption) MergeVirtualMachineOption(v VirtualMachineOption) error

MergeVirtualMachineOption performs a merge with any union data inside the RentalOption, using the provided VirtualMachineOption

func (*RentalOption) UnmarshalJSON

func (t *RentalOption) UnmarshalJSON(b []byte) error

func (RentalOption) ValueByDiscriminator

func (t RentalOption) ValueByDiscriminator() (interface{}, error)

type RentalStatus

type RentalStatus string

RentalStatus defines model for RentalStatus.

const (
	RentalStatusFailed      RentalStatus = "Failed"
	RentalStatusPending     RentalStatus = "Pending"
	RentalStatusRebooting   RentalStatus = "Rebooting"
	RentalStatusRunning     RentalStatus = "Running"
	RentalStatusTerminated  RentalStatus = "Terminated"
	RentalStatusTerminating RentalStatus = "Terminating"
	RentalStatusUnknown     RentalStatus = "Unknown"
)

Defines values for RentalStatus.

func (RentalStatus) Valid

func (e RentalStatus) Valid() bool

Valid indicates whether the value is a known member of the RentalStatus enum.

type RentalTerm

type RentalTerm struct {
	// contains filtered or unexported fields
}

RentalTerm defines model for RentalTerm.

func (RentalTerm) AsOnDemandTerm

func (t RentalTerm) AsOnDemandTerm() (OnDemandTerm, error)

AsOnDemandTerm returns the union data inside the RentalTerm as a OnDemandTerm

func (RentalTerm) AsPrivateCloudTerm

func (t RentalTerm) AsPrivateCloudTerm() (PrivateCloudTerm, error)

AsPrivateCloudTerm returns the union data inside the RentalTerm as a PrivateCloudTerm

func (RentalTerm) AsReservedTerm

func (t RentalTerm) AsReservedTerm() (ReservedTerm, error)

AsReservedTerm returns the union data inside the RentalTerm as a ReservedTerm

func (RentalTerm) Discriminator

func (t RentalTerm) Discriminator() (string, error)

func (*RentalTerm) FromOnDemandTerm

func (t *RentalTerm) FromOnDemandTerm(v OnDemandTerm) error

FromOnDemandTerm overwrites any union data inside the RentalTerm as the provided OnDemandTerm

func (*RentalTerm) FromPrivateCloudTerm

func (t *RentalTerm) FromPrivateCloudTerm(v PrivateCloudTerm) error

FromPrivateCloudTerm overwrites any union data inside the RentalTerm as the provided PrivateCloudTerm

func (*RentalTerm) FromReservedTerm

func (t *RentalTerm) FromReservedTerm(v ReservedTerm) error

FromReservedTerm overwrites any union data inside the RentalTerm as the provided ReservedTerm

func (RentalTerm) MarshalJSON

func (t RentalTerm) MarshalJSON() ([]byte, error)

func (*RentalTerm) MergeOnDemandTerm

func (t *RentalTerm) MergeOnDemandTerm(v OnDemandTerm) error

MergeOnDemandTerm performs a merge with any union data inside the RentalTerm, using the provided OnDemandTerm

func (*RentalTerm) MergePrivateCloudTerm

func (t *RentalTerm) MergePrivateCloudTerm(v PrivateCloudTerm) error

MergePrivateCloudTerm performs a merge with any union data inside the RentalTerm, using the provided PrivateCloudTerm

func (*RentalTerm) MergeReservedTerm

func (t *RentalTerm) MergeReservedTerm(v ReservedTerm) error

MergeReservedTerm performs a merge with any union data inside the RentalTerm, using the provided ReservedTerm

func (*RentalTerm) UnmarshalJSON

func (t *RentalTerm) UnmarshalJSON(b []byte) error

func (RentalTerm) ValueByDiscriminator

func (t RentalTerm) ValueByDiscriminator() (interface{}, error)

type RentalTermTypeSummary

type RentalTermTypeSummary struct {
	CostPerHourCents int `json:"costPerHourCents"`
	Count            int `json:"count"`
}

RentalTermTypeSummary How many active rentals are on one term type, and their summed hourly cost in cents.

type RentalTermination

type RentalTermination struct {
	Message  string `json:"message"`
	RentalID string `json:"rentalId"`
}

RentalTermination Confirmation that a rental is terminating.

type RentalType

type RentalType string

RentalType defines model for RentalType.

const (
	RentalTypeBareMetal      RentalType = "bare-metal"
	RentalTypeVirtualMachine RentalType = "virtual-machine"
)

Defines values for RentalType.

func (RentalType) Valid

func (e RentalType) Valid() bool

Valid indicates whether the value is a known member of the RentalType enum.

type RentalWithStatus

type RentalWithStatus struct {
	AttachedStorage           []AttachedStorage       `json:"attachedStorage"`
	ConnectionType            ConnectionType          `json:"connectionType"`
	ConvertToOnDemandOnExpiry nullable.Nullable[bool] `json:"convertToOnDemandOnExpiry"`
	CreatedAt                 time.Time               `json:"createdAt"`

	// CreatedBy The user who created a rental.
	CreatedBy               RentalCreator                        `json:"createdBy"`
	CurrentTerm             RentalTerm                           `json:"currentTerm"`
	EthernetVariant         nullable.Nullable[EthernetVariant]   `json:"ethernetVariant"`
	ExposedPorts            []int                                `json:"exposedPorts"`
	GPUCount                int                                  `json:"gpuCount"`
	GPUFormFactor           GPUFormFactor                        `json:"gpuFormFactor"`
	GPUType                 GPUType                              `json:"gpuType"`
	Instances               *[]RentalInstance                    `json:"instances,omitempty"`
	Label                   nullable.Nullable[string]            `json:"label"`
	ManagedCluster          nullable.Nullable[ManagedClusterRef] `json:"managedCluster"`
	MonitoringEnabled       bool                                 `json:"monitoringEnabled"`
	Name                    nullable.Nullable[string]            `json:"name"`
	NetworkInterfaces       []NetworkInterface                   `json:"networkInterfaces"`
	Nodes                   []RentalNode                         `json:"nodes"`
	OrgID                   nullable.Nullable[string]            `json:"orgId"`
	PortMappings            []PortMapping                        `json:"portMappings"`
	PrivateCluster          nullable.Nullable[PrivateCluster]    `json:"privateCluster"`
	Region                  string                               `json:"region"`
	RentalID                string                               `json:"rentalId"`
	RentalType              RentalType                           `json:"rentalType"`
	SSHEndpoints            []SSHEndpoint                        `json:"sshEndpoints"`
	StartedAt               nullable.Nullable[time.Time]         `json:"startedAt"`
	Status                  RentalStatus                         `json:"status"`
	SupportsAttachedStorage bool                                 `json:"supportsAttachedStorage"`
	SupportsCustomPorts     bool                                 `json:"supportsCustomPorts"`
	SupportsMultipleSSHKeys bool                                 `json:"supportsMultipleSshKeys"`
	SupportsPortForwarding  bool                                 `json:"supportsPortForwarding"`
	SupportsSSHKeyUpdates   bool                                 `json:"supportsSshKeyUpdates"`
	TerminatedAt            nullable.Nullable[time.Time]         `json:"terminatedAt"`
	TerminationReason       nullable.Nullable[string]            `json:"terminationReason"`
	UpdatedAt               nullable.Nullable[time.Time]         `json:"updatedAt"`
	UserID                  string                               `json:"userId"`
}

RentalWithStatus A GPU rental with its live status.

type RentalsService

type RentalsService struct {
	// contains filtered or unexported fields
}

RentalsService manages on-demand and reserved GPU rentals.

func (*RentalsService) ActiveSummary

func (s *RentalsService) ActiveSummary(ctx context.Context) (*ActiveRentalSummary, error)

ActiveSummary calls GET /v2/on-demand/active-rental-summary: get a summary of active rentals.

Count the caller's active rentals and sum their hourly cost in cents, in total and per term type.

func (*RentalsService) AttachSSHKey

func (s *RentalsService) AttachSSHKey(ctx context.Context, params AttachSSHKeyParams) (*SuccessResponse, error)

AttachSSHKey calls POST /v2/on-demand/rentals/ssh-keys/attach: attach an SSH key to a rental.

Attach a saved SSH public key to a running or pending virtual machine rental, without a restart.

func (*RentalsService) ConversionQuote

ConversionQuote calls GET /v2/on-demand/get-reserved-conversion-quote: get a reserved conversion quote.

func (*RentalsService) ConvertToReserved

ConvertToReserved calls POST /v2/on-demand/convert-to-reserved: convert a rental to a reserved term.

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

func (*RentalsService) Create

func (s *RentalsService) Create(ctx context.Context, params CreateRentalParams) (*Rental, error)

Create calls POST /v2/on-demand/rentals: create a rental.

Rent a virtual machine or a bare metal server. `rentalType` decides which machine-type-specific fields apply; sending a field for the other type is a BAD_REQUEST (INVALID_INPUT_FOR_RENTAL_TYPE).

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

Example

Rent the cheapest in-stock 8x H100 virtual machine, handling the one failure that can bill twice if ignored: a create whose outcome is unknown.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"
	"os"

	hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)

func main() {
	ctx := context.Background()
	client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
	if err != nil {
		log.Fatal(err)
	}

	options, err := client.Rentals.Options(ctx)
	if err != nil {
		log.Fatal(err)
	}
	var cheapest *hyperbolic.VirtualMachineOption
	for _, o := range options {
		vm, err := o.AsVirtualMachineOption()
		if err != nil || vm.MachineType != hyperbolic.VirtualMachineOptionMachineTypeVirtualMachine {
			continue
		}
		inStock := vm.Enabled && (vm.TotalAvailable == nil || *vm.TotalAvailable > 0)
		if vm.GPUType == hyperbolic.GPUTypeH100 && vm.GPUCount == 8 && inStock &&
			(cheapest == nil || vm.CostPerHourCents < cheapest.CostPerHourCents) {
			cheapest = &vm
		}
	}
	if cheapest == nil {
		log.Fatal("no 8x H100 in stock")
	}

	const label = "train-run-42"
	created, err := client.Rentals.Create(ctx, hyperbolic.CreateRentalParams{
		RentalType: hyperbolic.RentalTypeVirtualMachine,
		GPUType:    hyperbolic.Ptr(hyperbolic.GPUTypeH100),
		GPUCount:   8,
		Region:     hyperbolic.Ptr(cheapest.Region),
		Label:      hyperbolic.Ptr(label),
	})
	if errors.Is(err, hyperbolic.ErrOutcomeUnknown) {
		// The rental may exist. Look it up by label instead of creating
		// another one.
		for r, err := range client.Rentals.ListActiveAll(ctx, hyperbolic.ListActiveRentalsParams{}) {
			if err != nil {
				log.Fatal(err)
			}
			if l, _ := r.Label.Get(); l == label {
				fmt.Println("rental exists:", r.RentalID)
				return
			}
		}
		log.Fatal("the create did not take effect, so it is safe to try again")
	}
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("created rental", created.RentalID)
}

func (*RentalsService) DetachSSHKey

func (s *RentalsService) DetachSSHKey(ctx context.Context, params DetachSSHKeyParams) (*SuccessResponse, error)

DetachSSHKey calls POST /v2/on-demand/rentals/ssh-keys/detach: detach an SSH key from a rental.

Detach a saved SSH public key from a running or pending virtual machine rental, without a restart.

func (*RentalsService) ExtendReserved

ExtendReserved calls POST /v2/on-demand/extend-reserved: extend a reserved rental.

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

func (*RentalsService) ExtensionQuote

ExtensionQuote calls GET /v2/on-demand/get-reservation-extension-quote: get a reservation extension quote.

Get a reservation extension quote. Pass `termPeriodDays` to also get the price for that length as `requestedOption`.

func (*RentalsService) Get

Get calls GET /v2/on-demand/rental: get a rental.

Look up one rental by its ID, whether it is still running or has ended. Returns null when no rental with that ID belongs to the caller.

When nothing matches, the error matches ErrNotFound.

func (*RentalsService) HasHistory

func (s *RentalsService) HasHistory(ctx context.Context, params HasRentalHistoryParams) (bool, error)

HasHistory calls GET /v2/on-demand/has-rental-history: check whether any past rentals exist.

Whether the caller has at least one rental that has ended.

func (*RentalsService) ListActive

ListActive calls GET /v2/on-demand/rentals/active: list active rentals.

Active rentals with their live status, most recently started first, as numbered pages. Pass `rentalType` to list one machine type; omit it to list all of them.

func (*RentalsService) ListActiveAll

ListActiveAll iterates over the items of every page ListActive returns, from params.Page (the first page when unset). It stops at the first error, yielding it.

Example

List every active rental, a page at a time behind the iterator.

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)

func main() {
	ctx := context.Background()
	client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
	if err != nil {
		log.Fatal(err)
	}
	for r, err := range client.Rentals.ListActiveAll(ctx, hyperbolic.ListActiveRentalsParams{}) {
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(r.RentalID, r.Status, r.GPUCount, r.GPUType)
	}
}

func (*RentalsService) ListHistory

ListHistory calls GET /v2/on-demand/rentals/history: list past rentals.

Past rentals, most recently terminated first, one page at a time. Pass the response's `nextCursor` as `cursor` to read the next page.

func (*RentalsService) ListHistoryAll

ListHistoryAll iterates over the items of every page ListHistory returns, from params.Cursor (the first page when unset). It stops at the first error, yielding it.

func (*RentalsService) Options

func (s *RentalsService) Options(ctx context.Context) ([]RentalOption, error)

Options calls GET /v2/on-demand/rental-options: get a list of rental options.

func (*RentalsService) RebootInstance

RebootInstance calls POST /v2/on-demand/rentals/reboot-instance: reboot a single instance within a rental.

Reboots one instance in place; tenant data is preserved. Call it only for an instance whose `instances[].supportedFeatures` includes `guest-reboot`. Reports INVALID_INSTANCE_REF for an `instanceRef` outside this rental, REBOOT_NOT_SUPPORTED for a rental whose provider cannot reboot, and REBOOT_ALREADY_IN_PROGRESS while one is in flight.

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

func (*RentalsService) RequestReservation

func (s *RentalsService) RequestReservation(ctx context.Context, params RequestReservationParams) (*ReservationRequest, error)

RequestReservation calls POST /v2/on-demand/request-reservation: request a reservation.

Request a reservation for a large instance

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

func (*RentalsService) ReserveOptions

func (s *RentalsService) ReserveOptions(ctx context.Context, params ListReserveOptionsParams) (*ReserveOptions, error)

ReserveOptions calls GET /v2/on-demand/reserve-options: get a list of reserve options.

Get a list of reserve options. Pass `termPeriodDays` to also get the discount for that length as `requestedOption`.

func (*RentalsService) Terminate

Terminate calls POST /v2/on-demand/rentals/terminate: terminate a rental.

Terminate a virtual machine or bare metal rental.

func (*RentalsService) Update

func (s *RentalsService) Update(ctx context.Context, params UpdateRentalParams) (*Rental, error)

Update calls POST /v2/on-demand/rentals/update: update a rental.

Update a rental's label and/or its reserved-term end-of-term action. Pass an empty label to clear it.

type RequestReservationParams

type RequestReservationParams struct {
	GPUCount int `json:"gpuCount"`
}

RequestReservationParams defines model for RequestReservationParams.

type ReservationExtensionOption

type ReservationExtensionOption struct {
	DiscountPercentage float64   `json:"discountPercentage"`
	NewReservedUntil   time.Time `json:"newReservedUntil"`
	TermPeriodDays     int       `json:"termPeriodDays"`
	TotalPriceCents    float64   `json:"totalPriceCents"`
}

ReservationExtensionOption One term a reserved rental can be extended by.

type ReservationExtensionQuote

type ReservationExtensionQuote struct {
	CostPerHourCents float64                      `json:"costPerHourCents"`
	Options          []ReservationExtensionOption `json:"options"`

	// RequestedOption One term a reserved rental can be extended by.
	RequestedOption *ReservationExtensionOption `json:"requestedOption,omitempty"`
	ReservedUntil   time.Time                   `json:"reservedUntil"`
}

ReservationExtensionQuote What extending a reserved rental would cost, per term.

type ReservationRequest

type ReservationRequest struct {
	Message string `json:"message"`
}

ReservationRequest defines model for ReservationRequest.

type ReserveOptions

type ReserveOptions struct {
	Options []struct {
		DiscountPercentage float64 `json:"discountPercentage"`
		TermPeriodDays     int     `json:"termPeriodDays"`
	} `json:"options"`

	// RequestedOption The requested `termPeriodDays` with its discount. Only present when a length is passed.
	RequestedOption *struct {
		DiscountPercentage float64 `json:"discountPercentage"`
		TermPeriodDays     int     `json:"termPeriodDays"`
	} `json:"requestedOption,omitempty"`
}

ReserveOptions defines model for ReserveOptions.

type ReservedConversionOption

type ReservedConversionOption struct {
	DiscountPercentage float64 `json:"discountPercentage"`
	TermPeriodDays     int     `json:"termPeriodDays"`
	TotalPriceCents    float64 `json:"totalPriceCents"`
}

ReservedConversionOption One term an on-demand rental can be converted to.

type ReservedConversionQuote

type ReservedConversionQuote struct {
	CostPerHourCents        float64                    `json:"costPerHourCents"`
	EstimatedUsageTailCents float64                    `json:"estimatedUsageTailCents"`
	Options                 []ReservedConversionOption `json:"options"`
}

ReservedConversionQuote What converting an on-demand rental to reserved would cost, per term.

type ReservedRentalConversion

type ReservedRentalConversion struct {
	AmountChargedCents float64   `json:"amountChargedCents"`
	RentalID           string    `json:"rentalId"`
	ReservedUntil      time.Time `json:"reservedUntil"`
	UsageTailCents     float64   `json:"usageTailCents"`
}

ReservedRentalConversion An on-demand rental converted to reserved, and what it cost.

type ReservedRentalExtension

type ReservedRentalExtension struct {
	AmountChargedCents float64   `json:"amountChargedCents"`
	RentalID           string    `json:"rentalId"`
	ReservedUntil      time.Time `json:"reservedUntil"`
}

ReservedRentalExtension A reserved rental's new end, and what extending it cost.

type ReservedTerm

type ReservedTerm struct {
	CostPerHour         float64                      `json:"costPerHour"`
	DiscountPercentage  float64                      `json:"discountPercentage"`
	EffectiveAt         time.Time                    `json:"effectiveAt"`
	OriginalCostPerHour float64                      `json:"originalCostPerHour"`
	ReservationEndsAt   nullable.Nullable[time.Time] `json:"reservationEndsAt"`
	ReservedUntil       nullable.Nullable[time.Time] `json:"reservedUntil"`
	TermPeriodDays      int                          `json:"termPeriodDays"`
	TermType            ReservedTermTermType         `json:"termType"`
}

ReservedTerm defines model for ReservedTerm.

type ReservedTermTermType

type ReservedTermTermType string

ReservedTermTermType defines model for ReservedTerm.TermType.

const (
	ReservedTermTermTypeReserved ReservedTermTermType = "reserved"
)

Defines values for ReservedTermTermType.

func (ReservedTermTermType) Valid

func (e ReservedTermTermType) Valid() bool

Valid indicates whether the value is a known member of the ReservedTermTermType enum.

type RetryPolicy

type RetryPolicy struct {
	// MaxAttempts is the total number of attempts, including the first.
	// Values below 1 mean a single attempt.
	MaxAttempts int
	// BaseDelay is the delay before the first retry. It doubles each attempt.
	BaseDelay time.Duration
	// MaxDelay caps the delay between attempts. If the server asks for a
	// longer Retry-After than this, the client stops and returns the error so
	// the caller can reschedule instead of blocking.
	MaxDelay time.Duration
}

RetryPolicy controls how the client retries failed requests.

Reads and other idempotent calls are retried on 429, 502, 503, 504 and transport errors. Non-idempotent calls (create, reboot) are retried only on 429 or when the connection was never established, because anything else might have taken effect.

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

DefaultRetryPolicy is 3 attempts with exponential backoff from 500ms, capped at 10s.

func NoRetries

func NoRetries() RetryPolicy

NoRetries disables retries. Controllers that requeue on error often prefer this, so a reconcile never blocks on backoff.

type SSHEndpoint

type SSHEndpoint struct {
	Host string `json:"host"`
	Port int    `json:"port"`
	User string `json:"user"`
}

SSHEndpoint Where to connect to a rental over SSH.

type SSHKey

type SSHKey struct {
	CreatedAt time.Time `json:"createdAt"`

	// CreatedBy The user who added an SSH public key.
	CreatedBy SSHKeyCreator             `json:"createdBy"`
	ID        int                       `json:"id"`
	Name      nullable.Nullable[string] `json:"name"`
	OrgID     nullable.Nullable[string] `json:"orgId"`
	PublicKey string                    `json:"publicKey"`
	UserID    string                    `json:"userId"`
}

SSHKey An SSH public key saved to a user's account or an organization. userId is the member who added it; orgId is set when the key belongs to an organization.

type SSHKeyCreator

type SSHKeyCreator struct {
	Email string                    `json:"email"`
	Name  nullable.Nullable[string] `json:"name"`
}

SSHKeyCreator The user who added an SSH public key.

type SSHKeyWithLiveRentalCount

type SSHKeyWithLiveRentalCount struct {
	CreatedAt time.Time `json:"createdAt"`

	// CreatedBy The user who added an SSH public key.
	CreatedBy       SSHKeyCreator             `json:"createdBy"`
	ID              int                       `json:"id"`
	LiveRentalCount int                       `json:"liveRentalCount"`
	Name            nullable.Nullable[string] `json:"name"`
	OrgID           nullable.Nullable[string] `json:"orgId"`
	PublicKey       string                    `json:"publicKey"`
	UserID          string                    `json:"userId"`
}

SSHKeyWithLiveRentalCount An SSH public key, with the number of live rentals it is attached to.

type SSHKeysService

type SSHKeysService struct {
	// contains filtered or unexported fields
}

SSHKeysService manages the SSH public keys saved on the account.

func (*SSHKeysService) Create

func (s *SSHKeysService) Create(ctx context.Context, params CreateSSHKeyParams) (*SSHKey, error)

Create calls POST /v2/ssh-keys: create an SSH public key for the current user or organization.

Create an SSH public key for the current user or organization. Reports SSH_PUBLIC_KEY_ALREADY_EXISTS when a key with identical type and body already exists under the current user or organization.

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

func (*SSHKeysService) Delete

Delete calls POST /v2/ssh-keys/delete: delete an SSH public key.

Deletes an SSH public key. Reports SSH_PUBLIC_KEY_IN_USE while the key is attached to a live rental, SSH_PUBLIC_KEY_NOT_FOUND for a key that doesn't exist or the user doesn't control, and NOT_AUTHORIZED_TO_ACCESS_OWNED_RESOURCE for an organization key added by another member unless the caller is an organization admin.

func (*SSHKeysService) List

List calls GET /v2/ssh-keys: list SSH public keys for the current user or organization.

func (*SSHKeysService) ListForRental

func (s *SSHKeysService) ListForRental(ctx context.Context, params ListRentalSSHKeysParams) ([]SSHKey, error)

ListForRental calls GET /v2/ssh-keys/rental: list the SSH public keys attached to a rental.

List the SSH public keys attached to a rental. Reports RENTAL_NOT_FOUND for rentals that don't exist or the user doesn't control.

func (*SSHKeysService) Update

func (s *SSHKeysService) Update(ctx context.Context, params UpdateSSHKeyParams) (*SSHKey, error)

Update calls POST /v2/ssh-keys/update: rename an SSH public key.

Renames an SSH public key. Reports SSH_PUBLIC_KEY_NOT_FOUND for keys that don't exist or the user doesn't control, and NOT_AUTHORIZED_TO_ACCESS_OWNED_RESOURCE for an organization key added by another member unless the caller is an organization admin.

type StorageVolume

type StorageVolume struct {
	AttachedRentalIds []string                     `json:"attachedRentalIds"`
	CostPerHourCents  float64                      `json:"costPerHourCents"`
	CreatedAt         time.Time                    `json:"createdAt"`
	Label             string                       `json:"label"`
	OrgID             nullable.Nullable[string]    `json:"orgId"`
	Region            string                       `json:"region"`
	SizeInGb          int                          `json:"sizeInGb"`
	StartedAt         nullable.Nullable[time.Time] `json:"startedAt"`
	Status            StorageVolumeStatus          `json:"status"`
	StorageVolumeID   string                       `json:"storageVolumeId"`
	TerminatedAt      nullable.Nullable[time.Time] `json:"terminatedAt"`
	TerminationReason nullable.Nullable[string]    `json:"terminationReason"`
	UpdatedAt         nullable.Nullable[time.Time] `json:"updatedAt"`
	UserID            string                       `json:"userId"`
	VirtualIP         string                       `json:"virtualIp"`
}

StorageVolume A network storage volume.

type StorageVolumeChoice

type StorageVolumeChoice struct {
	// contains filtered or unexported fields
}

StorageVolumeChoice Bare metal only.

func (StorageVolumeChoice) AsExistingStorageVolume

func (t StorageVolumeChoice) AsExistingStorageVolume() (ExistingStorageVolume, error)

AsExistingStorageVolume returns the union data inside the StorageVolumeChoice as a ExistingStorageVolume

func (StorageVolumeChoice) AsNewStorageVolume

func (t StorageVolumeChoice) AsNewStorageVolume() (NewStorageVolume, error)

AsNewStorageVolume returns the union data inside the StorageVolumeChoice as a NewStorageVolume

func (*StorageVolumeChoice) FromExistingStorageVolume

func (t *StorageVolumeChoice) FromExistingStorageVolume(v ExistingStorageVolume) error

FromExistingStorageVolume overwrites any union data inside the StorageVolumeChoice as the provided ExistingStorageVolume

func (*StorageVolumeChoice) FromNewStorageVolume

func (t *StorageVolumeChoice) FromNewStorageVolume(v NewStorageVolume) error

FromNewStorageVolume overwrites any union data inside the StorageVolumeChoice as the provided NewStorageVolume

func (StorageVolumeChoice) MarshalJSON

func (t StorageVolumeChoice) MarshalJSON() ([]byte, error)

func (*StorageVolumeChoice) MergeExistingStorageVolume

func (t *StorageVolumeChoice) MergeExistingStorageVolume(v ExistingStorageVolume) error

MergeExistingStorageVolume performs a merge with any union data inside the StorageVolumeChoice, using the provided ExistingStorageVolume

func (*StorageVolumeChoice) MergeNewStorageVolume

func (t *StorageVolumeChoice) MergeNewStorageVolume(v NewStorageVolume) error

MergeNewStorageVolume performs a merge with any union data inside the StorageVolumeChoice, using the provided NewStorageVolume

func (*StorageVolumeChoice) UnmarshalJSON

func (t *StorageVolumeChoice) UnmarshalJSON(b []byte) error

type StorageVolumeOption

type StorageVolumeOption struct {
	CostPerGbHourCents float64 `json:"costPerGbHourCents"`
	MaxSizeInGb        int     `json:"maxSizeInGb"`
	Region             string  `json:"region"`
}

StorageVolumeOption defines model for StorageVolumeOption.

type StorageVolumeStatus

type StorageVolumeStatus string

StorageVolumeStatus defines model for StorageVolumeStatus.

const (
	StorageVolumeStatusActive   StorageVolumeStatus = "active"
	StorageVolumeStatusInactive StorageVolumeStatus = "inactive"
	StorageVolumeStatusUnknown  StorageVolumeStatus = "unknown"
)

Defines values for StorageVolumeStatus.

func (StorageVolumeStatus) Valid

func (e StorageVolumeStatus) Valid() bool

Valid indicates whether the value is a known member of the StorageVolumeStatus enum.

type StorageVolumesService

type StorageVolumesService struct {
	// contains filtered or unexported fields
}

StorageVolumesService manages network storage volumes and their attachments.

func (*StorageVolumesService) Attach

Attach calls POST /v2/on-demand/storage-volumes/attach: attach a storage volume to bare metal instance(s).

func (*StorageVolumesService) Create

Create calls POST /v2/on-demand/storage-volumes: create a storage volume.

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

func (*StorageVolumesService) List

List calls GET /v2/on-demand/storage-volumes: get a list of storage volumes.

func (*StorageVolumesService) Options

Options calls GET /v2/on-demand/storage-volume-options: get a list of storage volume options.

func (*StorageVolumesService) Terminate

Terminate calls POST /v2/on-demand/storage-volumes/terminate: terminate a storage volume.

func (*StorageVolumesService) Update

Update calls POST /v2/on-demand/storage-volumes/update: update a storage volume.

Update a storage volume's attached instances and/or size

type SuccessResponse

type SuccessResponse struct {
	Success bool `json:"success"`
}

SuccessResponse Result of an operation that returns no payload.

type TermType

type TermType string

TermType defines model for TermType.

const (
	TermTypeOnDemand     TermType = "on-demand"
	TermTypePrivateCloud TermType = "private-cloud"
	TermTypeReserved     TermType = "reserved"
)

Defines values for TermType.

func (TermType) Valid

func (e TermType) Valid() bool

Valid indicates whether the value is a known member of the TermType enum.

type TerminateRentalParams

type TerminateRentalParams struct {
	Reason   *string `json:"reason,omitempty"`
	RentalID string  `json:"rentalId"`
}

TerminateRentalParams defines model for TerminateRentalParams.

type TerminateStorageVolumeParams

type TerminateStorageVolumeParams struct {
	Reason          *string `json:"reason,omitempty"`
	StorageVolumeID string  `json:"storageVolumeId"`
}

TerminateStorageVolumeParams defines model for TerminateStorageVolumeParams.

type TerminateStorageVolumeResponse

type TerminateStorageVolumeResponse struct {
	Message         string `json:"message"`
	StorageVolumeID string `json:"storageVolumeId"`
}

TerminateStorageVolumeResponse Confirmation that a storage volume is terminating.

type TerminatedRentalLookup

type TerminatedRentalLookup struct {
	// Rental A GPU rental that has ended, with its total cost.
	Rental HistoricalRental            `json:"rental"`
	State  TerminatedRentalLookupState `json:"state"`
}

TerminatedRentalLookup A rental lookup that found a rental that has ended.

type TerminatedRentalLookupState

type TerminatedRentalLookupState string

TerminatedRentalLookupState defines model for TerminatedRentalLookup.State.

const (
	TerminatedRentalLookupStateTerminated TerminatedRentalLookupState = "terminated"
)

Defines values for TerminatedRentalLookupState.

func (TerminatedRentalLookupState) Valid

Valid indicates whether the value is a known member of the TerminatedRentalLookupState enum.

type UpdateCurrentUserParams

type UpdateCurrentUserParams struct {
	Name         nullable.Nullable[string] `json:"name,omitempty"`
	OnboardedFor nullable.Nullable[string] `json:"onboardedFor,omitempty"`
}

UpdateCurrentUserParams defines model for UpdateCurrentUserParams.

type UpdateRentalParams

type UpdateRentalParams struct {
	ConvertToOnDemandOnExpiry *bool   `json:"convertToOnDemandOnExpiry,omitempty"`
	Label                     *string `json:"label,omitempty"`
	RentalID                  string  `json:"rentalId"`
}

UpdateRentalParams defines model for UpdateRentalParams.

type UpdateSSHKeyParams

type UpdateSSHKeyParams struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

UpdateSSHKeyParams defines model for UpdateSSHKeyParams.

type UpdateStorageVolumeParams

type UpdateStorageVolumeParams struct {
	Label           *string   `json:"label,omitempty"`
	RentalIds       *[]string `json:"rentalIds,omitempty"`
	SizeInGb        *int      `json:"sizeInGb,omitempty"`
	StorageVolumeID string    `json:"storageVolumeId"`
}

UpdateStorageVolumeParams defines model for UpdateStorageVolumeParams.

type UpdateStorageVolumeResponse

type UpdateStorageVolumeResponse struct {
	AttachedRentalIds []string `json:"attachedRentalIds"`
	Message           string   `json:"message"`
	SizeInGb          int      `json:"sizeInGb"`
	StorageVolumeID   string   `json:"storageVolumeId"`
}

UpdateStorageVolumeResponse Confirmation that a storage volume is being updated.

type User

type User struct {
	CreatedAt     time.Time                    `json:"createdAt"`
	Email         string                       `json:"email"`
	EmailVerified nullable.Nullable[bool]      `json:"emailVerified"`
	ID            string                       `json:"id"`
	IsActive      nullable.Nullable[bool]      `json:"isActive"`
	Name          nullable.Nullable[string]    `json:"name"`
	OnboardedAt   nullable.Nullable[time.Time] `json:"onboardedAt"`
	OnboardedFor  nullable.Nullable[string]    `json:"onboardedFor"`
	Picture       nullable.Nullable[string]    `json:"picture"`
	Provider      nullable.Nullable[string]    `json:"provider"`
	ReferralCode  nullable.Nullable[string]    `json:"referralCode"`
}

User A Hyperbolic user account.

type UserMutationResponse

type UserMutationResponse struct {
	Success bool `json:"success"`

	// User A Hyperbolic user account.
	User User `json:"user"`
}

UserMutationResponse The user account as it stands after an update.

type UsersService

type UsersService struct {
	// contains filtered or unexported fields
}

UsersService reads and updates the signed-in user.

func (*UsersService) DeleteMe

func (s *UsersService) DeleteMe(ctx context.Context) (*SuccessResponse, error)

DeleteMe calls DELETE /v2/users/me: delete the current user.

func (*UsersService) Me

func (s *UsersService) Me(ctx context.Context) (*CurrentUser, error)

Me calls GET /v2/users/me: get the current user.

func (*UsersService) UpdateMe

UpdateMe calls PUT /v2/users/me: update the current user.

func (*UsersService) VerifyPhoneNumber

func (s *UsersService) VerifyPhoneNumber(ctx context.Context, params VerifyPhoneNumberParams) (*SuccessResponse, error)

VerifyPhoneNumber calls PUT /v2/users/me/verify-phone-number: verify a phone number.

It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.

type VerifyPhoneNumberParams

type VerifyPhoneNumberParams struct {
	PhoneNumber string `json:"phoneNumber"`
}

VerifyPhoneNumberParams defines model for VerifyPhoneNumberParams.

type VirtualMachineOption

type VirtualMachineOption struct {
	ConnectionType   ConnectionType                  `json:"connectionType"`
	CostPerHourCents float64                         `json:"costPerHourCents"`
	Enabled          bool                            `json:"enabled"`
	EthernetVariant  *EthernetVariant                `json:"ethernetVariant,omitempty"`
	GPUCount         int                             `json:"gpuCount"`
	GPUFormFactor    GPUFormFactor                   `json:"gpuFormFactor"`
	GPUType          GPUType                         `json:"gpuType"`
	MachineType      VirtualMachineOptionMachineType `json:"machineType"`
	Nodes            []struct {
		CPUModel  string `json:"cpuModel"`
		GPUCount  int    `json:"gpuCount"`
		RAMGb     int    `json:"ramGb"`
		StorageGb int    `json:"storageGb"`
		VcpuCount int    `json:"vcpuCount"`
	} `json:"nodes"`
	Region                  string `json:"region"`
	SupportsCustomPorts     bool   `json:"supportsCustomPorts"`
	SupportsMultipleSSHKeys bool   `json:"supportsMultipleSshKeys"`
	SupportsSSHKeyUpdates   bool   `json:"supportsSshKeyUpdates"`
	TotalAvailable          *int   `json:"totalAvailable,omitempty"`
}

VirtualMachineOption defines model for VirtualMachineOption.

type VirtualMachineOptionMachineType

type VirtualMachineOptionMachineType string

VirtualMachineOptionMachineType defines model for VirtualMachineOption.MachineType.

const (
	VirtualMachineOptionMachineTypeVirtualMachine VirtualMachineOptionMachineType = "virtual-machine"
)

Defines values for VirtualMachineOptionMachineType.

func (VirtualMachineOptionMachineType) Valid

Valid indicates whether the value is a known member of the VirtualMachineOptionMachineType enum.

Directories

Path Synopsis
Package hyperbolictest provides an in-memory fake of the Hyperbolic API for tests, with fault injection for the failures that matter most to callers: rate limiting, 5xx responses, timeouts, and failures that happen after the server has already applied a request.
Package hyperbolictest provides an in-memory fake of the Hyperbolic API for tests, with fault injection for the failures that matter most to callers: rate limiting, 5xx responses, timeouts, and failures that happen after the server has already applied a request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL