Namespace provider for ComputeSDK - cloud-native sandboxes with optional GPU support
npm install @computesdk/namespaceNamespace provider for ComputeSDK that enables creating and managing containerized sandboxes on Namespace's infrastructure.
``bash`
npm install @computesdk/namespace
The Namespace provider requires the following environment variable:
`bash`
NSC_TOKEN=your_namespace_token
Use the gateway for zero-config auto-detection:
`typescript
import { compute } from 'computesdk';
// Auto-detects Namespace from NSC_TOKEN environment variable
const sandbox = await compute.sandbox.create();
console.log(Created sandbox: ${sandbox.id});
// List all sandboxes
const sandboxes = await compute.sandbox.list();
// Destroy the sandbox
await sandbox.destroy();
`
For direct SDK usage without the gateway:
`typescript
import { namespace } from '@computesdk/namespace';
const compute = namespace({
token: 'your_token'
});
// Create a sandbox
const sandbox = await compute.sandbox.create({ runtime: 'node' });
console.log(Created sandbox: ${sandbox.id});
// List all sandboxes
const sandboxes = await compute.sandbox.list();
// Destroy the sandbox
await sandbox.destroy();
``
- Instances are automatically deployed upon creation
- Instance names are generated automatically
- All operations use Namespace's compute API
- Environment variables take precedence over config options
- Instances are immediately deleted when destroyed (no delayed deletion)