Overview

By default, the Gbox SDK connects to the production API at https://gbox.ai/api/v1. You can customize this base URL to connect to different environments or self-hosted instances.

Configuration

Global Configuration

Set the base URL when initializing the SDK:

import GboxSDK from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"],
  baseURL: "https://gbox.ai/api/v1", // This is the default
});

Environment-Based Configuration

For better flexibility, use environment variables to manage different base URLs:

import GboxSDK from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"],
  baseURL: process.env["GBOX_BASE_URL"] || "https://gbox.ai/api/v1",
});

async function main() {
  const box = await gboxSDK.create({ type: "android" });
  console.log("Device created:", box.id);
}

main();

Environment Variables

Set up your environment variables in a .env file:

GBOX_API_KEY=your_api_key_here
GBOX_BASE_URL=https://your-custom-endpoint.com/api/v1