Documentation Index
Fetch the complete documentation index at: https://docs.gbox.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Run Code feature allows you to execute code in multiple programming languages directly on GBOX.
Supported Languages
| Language | Identifier | Description |
|---|
| Python | python | Python 3.x with common packages |
| TypeScript | typescript | TypeScript with tsx runtime |
| Bash | bash | Bash shell commands |
Usage
import GboxSDK from "gbox-sdk";
import * as dotenv from "dotenv";
dotenv.config();
const gboxSDK = new GboxSDK({
apiKey: process.env["GBOX_API_KEY"],
});
async function main() {
try {
// Create a Linux box
const box = await gboxSDK.create({ type: "linux" });
// Example 1: Simple Python code execution
console.log("=== Python Example ===");
const pythonResult1 = await box.runCode("print('Hello, world!')");
console.log(pythonResult1);
// Example 2: Python code with explicit language specification
const pythonResult2 = await box.runCode({
code: `print("Hello, world!")`,
language: "python",
});
console.log(pythonResult2);
// Example 3: TypeScript code execution
console.log("\n=== TypeScript Examples ===");
const tsResult1 = await box.runCode({
code: `console.log("Hello, world!");`,
language: "typescript",
});
console.log(tsResult1);
// Clean up - terminate the box
await box.terminate();
console.log("\n✅ Box terminated successfully");
} catch (error) {
console.error("❌ Error:", error);
}
}
// Run the main function
main();
OpenAI Simple Integration
Learn how to integrate OpenAI with GBOX to generate and execute Python code
from natural language prompts
OpenAI Function Calling
Use OpenAI’s Function Calling feature to create an AI assistant that can
execute code in GBOX based on user queries
Anthropic Simple Integration
Learn how to integrate Anthropic Claude with GBOX to generate and execute
Python code from natural language prompts
Anthropic Function Calling
Use Anthropic’s Function Calling feature to create an AI assistant that can
execute code in GBOX based on user queries