1. Providers
  2. HopX

HopX provider for ComputeSDK

Installation & Setup

npm install @computesdk/hopx

Add your HopX credentials to a .env file:

HOPX_API_KEY=your_hopx_api_key

Usage

import { hopx } from '@computesdk/hopx';

const compute = hopx({
  apiKey: process.env.HOPX_API_KEY,
});

// Create sandbox
const sandbox = await compute.sandbox.create();

// Run a command
const result = await sandbox.runCommand('echo "Hello from HopX!"');
console.log(result.stdout); // "Hello from HopX!"

// Clean up
await sandbox.destroy();

Configuration Options

interface HopxConfig {
  /** HopX API key - if not provided, will use HOPX_API_KEY env var */
  apiKey?: string;
  /** Execution timeout in milliseconds */
  timeout?: number;
  /** Template name for sandbox creation (e.g. 'code-interpreter') */
  template?: string;
  /** Base API URL for custom/staging environments */
  baseURL?: string;
}