For the complete documentation index, see llms.txt. This page is also available as Markdown.

GravixLayer

GravixLayer provider for ComputeSDK — cloud runtimes with a native filesystem API, live command streaming, port publishing, templates, and snapshots.

Installation & Setup

npm install @computesdk/gravixlayer

Add your GravixLayer API key to a .env file:

GRAVIXLAYER_API_KEY=your_gravixlayer_api_key

Optional:

GRAVIXLAYER_BASE_URL=https://api.gravixlayer.ai
GRAVIXLAYER_CLOUD=aws
GRAVIXLAYER_REGION=us-east-1

Get your API key at gravixlayer.ai. Product docs: docs.gravixlayer.ai.

Usage

import { gravixlayer } from '@computesdk/gravixlayer'

const compute = gravixlayer({
  apiKey: process.env.GRAVIXLAYER_API_KEY,
})

const sandbox = await compute.sandbox.create({
  templateId: 'base-small',
})

const result = await sandbox.runCommand('echo "Hello from GravixLayer!"')
console.log(result.stdout)

await sandbox.destroy()

templateId selects an existing template. To start from a snapshot, pass snapshotId instead (not both). image is not accepted; build a template from an image with template.create({ name, fromImage }) and pass its name as templateId. Create a snapshot with compute.snapshot.create(sandboxId, { name: 'my-snapshot' }) — a name is required. Building a new template needs fromImage or dockerfile on template.create; pick an existing template with templateId on sandbox create.

Configuration Options

Option
Environment variable
Description

apiKey

GRAVIXLAYER_API_KEY

GravixLayer API key (required)

baseUrl

GRAVIXLAYER_BASE_URL

API origin

cloud

GRAVIXLAYER_CLOUD

Default cloud for placement

region

GRAVIXLAYER_REGION

Default region for placement

timeout

—

Request timeout in milliseconds

maxRetries

—

Retry budget (default 0)

http2

—

Use HTTP/2 (default true)

Last updated

Was this helpful?