> ## 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.

# Custom Base URL

> Configure custom API endpoints for different environments

## 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:

<CodeGroup>
  ```typescript Production (Default) theme={null}
  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
  });
  ```

  ```typescript Development Environment theme={null}
  import GboxSDK from "gbox-sdk";

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

  ```typescript Local Development theme={null}
  import GboxSDK from "gbox-sdk";

  const gboxSDK = new GboxSDK({
    apiKey: process.env["GBOX_API_KEY"],
    baseURL: "http://localhost:3000/api/v1",
  });
  ```
</CodeGroup>

### Environment-Based Configuration

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

```typescript theme={null}
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:

```bash theme={null}
GBOX_API_KEY=your_api_key_here
GBOX_BASE_URL=https://your-custom-endpoint.com/api/v1
```
