> ## Documentation Index
> Fetch the complete documentation index at: https://docs.novita.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Your First Sandbox

## Create an Account

If you don't have a Novita account, [sign up](https://novita.ai/user/register) first. For details, please refer to [Quickstart guide](/guides/quickstart).

New users can complete a quick account setup survey to receive \$100 in promotional  Sandbox credits. No credit card is required.

## Create API Key

Create an API key on the Novita [Key Management page](https://novita.ai/settings/key-management) and keep it for later use.

## Install SDK

You can install the Novita SDK by executing the following commands.

**JavaScript & TypeScript SDK**

```bash CLI icon="terminal" theme={"system"}
npm i novita-sandbox
```

**Python SDK**

```bash CLI icon="terminal" theme={"system"}
pip install novita-sandbox
```

## Configure Environment Variables

Create a `.env` file in your project folder if it does not exist, and configure your API key.

The SDK reads `NOVITA_API_KEY` from the environment. `dotenv/config` in JavaScript and `load_dotenv()` in Python only load the value into the process environment; you do not need to pass the API key into each example manually.

**.env**

```text Output icon="code" theme={"system"}
NOVITA_API_KEY=sk_*** # Novita API key obtained from previous steps
```

Or you can configure the API key by setting an environment variable in your terminal.

```bash CLI icon="terminal" theme={"system"}
export NOVITA_API_KEY=sk_*** # Novita API key obtained from previous steps
```

## Start a Sandbox with the SDK

Below is a simple example showing how to create a sandbox, execute code inside it, and list files in the sandbox filesystem.

<CodeGroup>
  ```js JavaScript & TypeScript icon="js" theme={"system"}
  // index.ts
  import 'dotenv/config'
  import { Novita } from 'novita-sandbox'

  async function main() {
    const novita = new Novita()
    const sandbox = await novita.codeInterpreter.create()
    try {
      const execution = await sandbox.runCode('print("hello world")')
      console.log(execution.logs)

      const files = await sandbox.files.list('/tmp')
      console.log(files)
    } finally {
      // Close sandbox when no longer needed
      await sandbox.kill()
    }
  }

  main().catch((err) => {
    console.error(err)
    process.exit(1)
  })
  ```

  ```python Python icon="python" theme={"system"}
  # main.py
  from dotenv import load_dotenv
  from novita_sandbox import Novita

  # The .env file should be located in the project root directory
  # dotenv will automatically look for .env in the current working directory
  load_dotenv()

  novita = Novita()
  sandbox = novita.code_interpreter.create()
  try:
      execution = sandbox.run_code("print('hello world')")
      print(execution.logs)

      files = sandbox.files.list("/tmp")
      print(files)
  finally:
      # Close sandbox when no longer needed
      sandbox.kill()
  ```
</CodeGroup>

Execute the following commands to run the code.

**index.ts**

```bash CLI icon="terminal" theme={"system"}
npx tsx ./index.ts
```

**main.py**

```bash CLI icon="terminal" theme={"system"}
python main.py
```
