Skip to content

VB-OS Node.js SDK Authentication

import { VBOSClient } from '@vb-os/sdk';
const client = new VBOSClient({
apiKey: 'vbos_key_...',
});

The apiKey parameter is required. All other parameters are optional.

Parameter Type Default Description
apiKey string (required) API key for authentication
baseUrl string https://api.vb-os.org API base URL
timeout number 30 Request timeout in seconds
maxRetries number 3 Maximum retry attempts for failed requests
randomFn () => number Math.random Random function for jitter (useful in tests)
const client = new VBOSClient({
apiKey: process.env.VBOS_API_KEY,
baseUrl: 'https://api.vb-os.org',
timeout: 60,
maxRetries: 5,
});

Store your API key in an environment variable rather than hardcoding it:

const client = new VBOSClient({
apiKey: process.env.VBOS_API_KEY,
});

Pass a custom randomFn to make retry jitter deterministic in tests:

const client = new VBOSClient({
apiKey: 'test-key',
randomFn: () => 0.5,
});

The SDK automatically sets the following headers on every request:

  • Authorization: Bearer <apiKey>
  • Content-Type: application/json
  • User-Agent: @vb-os/sdk/0.1.0