@gpuai/sdk
v0.5.8
Published
TypeScript SDK for the GPU.ai Public Developer API
Readme
@gpuai/[email protected]
A TypeScript SDK client for the api.gpu.ai API.
Usage
First, install the SDK from npm.
npm install @gpuai/sdk --saveNext, try it out.
import {
Configuration,
AutolaunchApi,
} from '@gpuai/sdk';
import type { CreateAutolaunchRuleRequest } from '@gpuai/sdk';
async function example() {
console.log("🚀 Testing @gpuai/sdk SDK...");
const config = new Configuration({
// Configure HTTP bearer authorization: bearerAuth
accessToken: "YOUR BEARER TOKEN",
});
const api = new AutolaunchApi(config);
const body = {
// AutolaunchRuleCreate
autolaunchRuleCreate: ...,
// string (optional)
idempotencyKey: idempotencyKey_example,
} satisfies CreateAutolaunchRuleRequest;
try {
const data = await api.createAutolaunchRule(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);Documentation
API Endpoints
All URIs are relative to https://api.gpu.ai/v1
| Class | Method | HTTP request | Description | ----- | ------ | ------------ | ------------- AutolaunchApi | createAutolaunchRule | POST /autolaunch-rules | Create an auto-launch rule (pre-approves a bounded, unattended spend) AutolaunchApi | deleteAutolaunchRule | DELETE /autolaunch-rules/{id} | Cancel an auto-launch rule AutolaunchApi | disarmAutolaunchRule | PATCH /autolaunch-rules/{id} | Disarm an auto-launch rule AutolaunchApi | getAutolaunchRule | GET /autolaunch-rules/{id} | Get an auto-launch rule AutolaunchApi | listAutolaunchRules | GET /autolaunch-rules | List auto-launch rules BillingApi | createCryptoDeposit | POST /billing/deposits/crypto | Create a stablecoin deposit BillingApi | downloadInvoicePdf | GET /billing/invoices/{id}/pdf | Download an invoice PDF BillingApi | getBalance | GET /billing/balance | Get the org credit balance BillingApi | getBillingDetails | GET /billing/details | Get billing details BillingApi | getDeposit | GET /billing/deposits/{id} | Get one stablecoin deposit BillingApi | getSpendingLimit | GET /billing/spending-limit | Get the org spending limit BillingApi | listDeposits | GET /billing/deposits | List stablecoin deposits BillingApi | listInvoices | GET /billing/invoices | List invoices BillingApi | updateBillingDetails | PATCH /billing/details | Update billing details BillingApi | updateSpendingLimit | PUT /billing/spending-limit | Set the org spending limit CommunityApi | delistCommunityMachine | POST /community/machines/{id}/delist | Delist a Community Cloud machine CommunityApi | enableCommunitySupplier | POST /community/suppliers | Enable the Community Cloud supplier role CommunityApi | getCommunitySupplierMe | GET /community/suppliers/me | Get the caller's Community Cloud supplier CommunityApi | listCommunityMachines | GET /community/machines | List your Community Cloud machines CommunityApi | reclaimCommunityMachine | POST /community/machines/{id}/reclaim | Reclaim a spot-tier Community Cloud machine CommunityApi | registerCommunityMachine | POST /community/machines | Register a Community Cloud machine EndpointsApi | createEndpoint | POST /endpoints | Create a model endpoint EndpointsApi | createEndpointChatCompletion | POST /endpoints/{id}/openai/v1/chat/completions | Chat completion on a model endpoint (OpenAI-compatible) EndpointsApi | createEndpointCompletion | POST /endpoints/{id}/openai/v1/completions | Text completion on a model endpoint (OpenAI-compatible) EndpointsApi | deleteEndpoint | DELETE /endpoints/{id} | Delete a model endpoint EndpointsApi | getEndpoint | GET /endpoints/{id} | Get a model endpoint EndpointsApi | listEndpointModels | GET /endpoints/{id}/openai/v1/models | List the model an endpoint serves (OpenAI-compatible) EndpointsApi | listEndpoints | GET /endpoints | List model endpoints EnvironmentsApi | getEnvironments | GET /environments | List launch environments (no auth required) FineTuningApi | cancelFineTuningJob | POST /fine_tuning/jobs/{id}/cancel | Cancel a fine-tuning job (OpenAI-compatible) FineTuningApi | createFile | POST /files | Upload a fine-tuning dataset file (OpenAI-compatible) FineTuningApi | createFineTuningJob | POST /fine_tuning/jobs | Create a managed fine-tuning job (OpenAI-compatible) FineTuningApi | getFineTuningJob | GET /fine_tuning/jobs/{id} | Retrieve a fine-tuning job (OpenAI-compatible) FineTuningApi | listFineTuningJobEvents | GET /fine_tuning/jobs/{id}/events | List fine-tuning job events (OpenAI-compatible) FineTuningApi | listFineTuningJobs | GET /fine_tuning/jobs | List fine-tuning jobs (OpenAI-compatible) FineTuningApi | retrieveFile | GET /files/{id} | Retrieve a file (OpenAI-compatible) FunctionsApi | activateFunctionVersion | POST /functions/{id}/versions/{version_id}/activate | Confirm a version's upload and make it current FunctionsApi | cancelFunctionRun | POST /functions/{id}/runs/{run_id}/cancel | Cancel a run FunctionsApi | createFunction | POST /functions | Get or create a function by name FunctionsApi | createFunctionRun | POST /functions/{id}/runs | Call a function FunctionsApi | createFunctionVersion | POST /functions/{id}/versions | Register a version of a function FunctionsApi | deleteFunction | DELETE /functions/{id} | Delete a function FunctionsApi | getFunction | GET /functions/{id} | Get a function FunctionsApi | getFunctionRun | GET /functions/{id}/runs/{run_id} | Get a run FunctionsApi | getFunctionRunLogs | GET /functions/{id}/runs/{run_id}/logs | Read a run's output FunctionsApi | listFunctionRuns | GET /functions/{id}/runs | List a function's runs FunctionsApi | listFunctions | GET /functions | List functions GpuTypesApi | listGpuTypes | GET /gpu-types | List available GPU types (no auth required) InferenceApi | cancelVideo | POST /videos/{id}/cancel | Cancel a video generation job InferenceApi | createChatCompletion | POST /chat/completions | Create a chat completion (OpenAI-compatible) InferenceApi | createEmbeddings | POST /embeddings | Create embeddings (OpenAI-compatible) InferenceApi | createImage | POST /images/generations | Create image (OpenAI-compatible) InferenceApi | createVideo | POST /videos | Create a video generation job (async) InferenceApi | getDataRetention | GET /organization/data-retention | Get the org zero data retention setting InferenceApi | getModel | GET /models/{id} | Get a specific model (OpenAI-compatible) InferenceApi | getVideo | GET /videos/{id} | Get a video generation job InferenceApi | getVideoContent | GET /videos/{id}/content | Download a completed video artifact InferenceApi | listModels | GET /models | List available models (OpenAI-compatible) InferenceApi | listVideos | GET /videos | List video generation jobs InferenceApi | updateDataRetention | PUT /organization/data-retention | Turn zero data retention on or off for the org InstancesApi | createInstance | POST /instances | Create an instance (async — returns 202 + Operation-Id header) InstancesApi | deleteInstance | DELETE /instances/{id} | Terminate an instance (idempotent) InstancesApi | getDedicatedIpOffer | GET /dedicated-ip | Get the dedicated public IP add-on offer InstancesApi | getInstance | GET /instances/{id} | Get an instance InstancesApi | getInstanceGpuSuggestion | GET /instances/{id}/gpu-suggestion | Suggest a lower-priced GPU for an instance InstancesApi | listInstances | GET /instances | List instances InstancesApi | updateInstance | PATCH /instances/{id} | Update an instance (rename only in v1) JobsApi | cancelJob | POST /jobs/{id}/cancel | Cancel a job JobsApi | createJob | POST /jobs | Submit a job JobsApi | getJob | GET /jobs/{id} | Get a job JobsApi | getJobLogs | GET /jobs/{id}/logs | Read a job's output JobsApi | getJobTelemetry | GET /jobs/{id}/telemetry | Read a job's GPU memory telemetry JobsApi | getJobTrial | GET /jobs/trial | Whether this organization's first jobs are free JobsApi | listJobGpuTypes | GET /jobs/gpu-types | List the GPU types a job can run on JobsApi | listJobs | GET /jobs | List jobs MarketApi | getMarketHistory | GET /market-history | Get a GPU's price and availability over time MetaApi | getHealth | GET /health | Liveness probe MetaApi | getOpenApiSpec | GET /openapi.json | OpenAPI 3.1 specification OperationsApi | cancelOperation | POST /operations/{id}/cancel | Cancel a launch that has not created its instance yet OperationsApi | getOperation | GET /operations/{id} | Get an async operation status PricingApi | listPricing | GET /pricing | List pricing per GPU type + region (no auth required) RegistryCredentialsApi | createRegistryCredential | POST /registry-credentials | Store a registry credential RegistryCredentialsApi | deleteRegistryCredential | DELETE /registry-credentials/{id} | Delete a registry credential RegistryCredentialsApi | listRegistryCredentials | GET /registry-credentials | List registry credentials SecretsApi | createSecret | POST /secrets | Create a secret SecretsApi | deleteSecret | DELETE /secrets/{name} | Delete a secret SecretsApi | getSecret | GET /secrets/{name} | Get a secret's metadata SecretsApi | importSecrets | POST /secrets/import | Import secrets SecretsApi | listSecrets | GET /secrets | List secrets SecretsApi | putSecret | PUT /secrets/{name} | Create or replace a secret SshKeysApi | createSshKey | POST /ssh-keys | Create an SSH key SshKeysApi | deleteSshKey | DELETE /ssh-keys/{id} | Delete an SSH key (idempotent — 404 on already-gone per D-07) SshKeysApi | getSshKey | GET /ssh-keys/{id} | Get an SSH key SshKeysApi | listSshKeys | GET /ssh-keys | List SSH keys TemplatesApi | getTemplate | GET /templates/{id} | Get one deployable application template TemplatesApi | listTemplates | GET /templates | List deployable application templates UsageApi | listUsage | GET /usage | Time-bucketed usage WatchApi | createWatchRule | POST /watch-rules | Create a watch rule WatchApi | deleteWatchRule | DELETE /watch-rules/{id} | Delete a watch rule WatchApi | getWatchRule | GET /watch-rules/{id} | Get a watch rule WatchApi | listWatchRules | GET /watch-rules | List watch rules WatchApi | updateWatchRule | PATCH /watch-rules/{id} | Update a watch rule WebhooksApi | createWebhookEndpoint | POST /webhook-endpoints | Create a webhook endpoint WebhooksApi | deleteWebhookEndpoint | DELETE /webhook-endpoints/{id} | Delete a webhook endpoint WebhooksApi | getWebhookEndpoint | GET /webhook-endpoints/{id} | Get a webhook endpoint WebhooksApi | listWebhookEndpoints | GET /webhook-endpoints | List webhook endpoints
Models
- AutolaunchRule
- AutolaunchRuleCreate
- AutolaunchRuleDisarm
- AutolaunchRulePage
- Balance
- BillingDetails
- ChatChoice
- ChatCompletionRequest
- ChatCompletionRequestToolChoice
- ChatCompletionResponse
- ChatJSONSchemaFormat
- ChatMessage
- ChatNamedToolChoice
- ChatNamedToolChoiceFunction
- ChatResponseFormat
- ChatTool
- ChatToolCall
- ChatToolCallFunction
- ChatToolFunction
- CommunityMachine
- CommunityMachineDelistResult
- CommunityMachineRegistration
- CommunitySupplier
- CreateCryptoDepositRequest
- CreateFineTuningJobRequest
- CreateFineTuningJobRequestGpuai
- CreateFineTuningJobRequestMethod
- CreateFineTuningJobRequestMethodLora
- CreateFunctionRequest
- CreateFunctionRunRequest
- CreateFunctionVersionRequest
- CreateInstanceRequest
- CreateInstanceRequestPortsInner
- CreateRegistryCredentialRequest
- CreateSshKeyRequest
- CreateWebhookEndpointRequest
- CryptoDeposit
- DataRetention
- DedicatedIPOffer
- DedicatedIPRequest
- Embedding
- EmbeddingsRequest
- EmbeddingsRequestInput
- EmbeddingsResponse
- EmbeddingsUsage
- Endpoint
- EndpointCreate
- EndpointList
- EndpointMachine
- EndpointReplicaCounts
- Environments
- FileObject
- FineTuningJob
- FineTuningJobError
- FineTuningJobEvent
- FineTuningJobEventList
- FineTuningJobList
- FineTuningJobMethod
- FrameworkVersion
- Function
- FunctionList
- FunctionReplicaCounts
- FunctionRun
- FunctionRunError
- FunctionRunList
- FunctionRunLogChunk
- FunctionRunLogs
- FunctionUpload
- FunctionVersion
- GPUType
- GPUTypePage
- GetHealth200Response
- GpuSuggestion
- GpuSuggestionCheaper
- GpuSuggestionGpu
- ImagesGenerationsRequest
- ImagesResponse
- ImagesResponseDataInner
- ImagesResponseUsage
- IncludeItem
- Instance
- InstanceConnection
- InstanceDedicatedIP
- InstanceGpuMemory
- InstancePage
- Invoice
- InvoiceList
- Job
- JobAttempt
- JobCreate
- JobCreateRepo
- JobGpuTypes
- JobGpuTypesDataInner
- JobLogChunk
- JobLogs
- JobPage
- JobSharingHint
- JobTelemetry
- JobTelemetryPoint
- JobTrial
- ListCommunityMachines200Response
- ListDeposits200Response
- ListRegistryCredentials200Response
- MarketHistoryPoint
- MarketHistoryResponse
- Model
- ModelList
- ModelParametersInner
- ModelPricing
- ModelRate
- OfferingAlternative
- OpenAIErrorEnvelope
- OpenAIErrorEnvelopeError
- Operation
- OperationError
- OperationResult
- PeakWindow
- Pricing
- PricingPage
- Problem
- RegisterCommunityMachineRequest
- RegistryCredential
- SSHKey
- SSHKeyPage
- Secret
- SecretCreate
- SecretImportItem
- SecretImportRequest
- SecretImportResult
- SecretList
- SecretPut
- SpendingLimit
- StreamOptions
- SupplierMachineView
- Template
- TemplateEnvInner
- TemplateList
- TemplatePortsInner
- UpdateBillingDetailsRequest
- UpdateDataRetentionRequest
- UpdateInstanceRequest
- UpdateSpendingLimitRequest
- Usage
- UsageBucket
- UsagePage
- VMImage
- VideoCreateRequest
- VideoJob
- VideoList
- WatchRule
- WatchRuleCreate
- WatchRulePage
- WatchRuleUpdate
- WebhookEndpoint
- WebhookEndpointPage
Authorization
Authentication schemes defined for the API:
bearerAuth
- Type: HTTP Bearer Token authentication (gpuai_live_<24-base62>)
About
This TypeScript SDK client supports the Fetch API and is automatically generated by the OpenAPI Generator project:
- API version:
1.0.0 - Package version:
0.5.8 - Generator version:
7.24.0 - Build package:
org.openapitools.codegen.languages.TypeScriptFetchClientCodegen
The generated npm module supports the following:
- Environments
- Node.js
- Webpack
- Browserify
- Language levels
- ES5 - you must have a Promises/A+ library installed
- ES6
- Module systems
- CommonJS
- ES6 module system
Development
Building
To build the TypeScript source code, you need to have Node.js and npm installed. After cloning the repository, navigate to the project directory and run:
npm install
npm run buildPublishing
Once you've built the package, you can publish it to npm:
npm publish