1

Get an API Key

  1. Go to Gbox AI
  2. Copy your API Key
  3. Paste your Gbox API Key into your env file
.env
GBOX_API_KEY=gbox-******
2

Install Gbox SDK

Install the Gbox SDK to your project by running the following command in your terminal.

npm install gbox-sdk dotenv
3

Write code for create a box

Create a sample code in your project to create a box and execute Python code.

import GboxSDK from "gbox-sdk";
import * as dotenv from "dotenv";

dotenv.config();

const gboxSDK = new GboxSDK();

async function main() {
  const myBox = await gboxSDK.create({ type: "linux" });

  console.log(`Linux box created: ${myBox.id}`);

  const result = await myBox.runCode({
    code: `print("Hello from Python!")`,
    language: "python"
  })

  console.log("Python execution result:");
  console.log(result)
}

main();
4

Run the code

npx tsx ./index.ts