> For the complete documentation index, see [llms.txt](https://docs.computesdk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.computesdk.com/interfaces/sdk/sdk-quick-start.md).

# Quickstart

```typescript
import { compute } from 'computesdk';

const sandbox = await compute.instances.create();
try {
  const result = await sandbox.runCommand('echo hello');
  console.log(result.stdout);
} finally {
  await sandbox.destroy();
}
```

Create a sandbox, run a command and destroy it when finished. ComputeSDK handles routing across providers. Save this example as `hello.mts`.

## Install

Use Node.js 22 or later:

```bash
mkdir compute-hello
cd compute-hello
npm init -y
npm install computesdk
npm install --save-dev tsx typescript @types/node
```

## Set your API key

Create an organization API key in **Settings → API keys** in the [dashboard](https://platform.computesdk.com), then export it:

```bash
export COMPUTE_API_KEY="your_org_api_key"
```

In PowerShell, use `$env:COMPUTE_API_KEY="your_org_api_key"`. Keep the key in your server environment, outside browser code and source control. See [authentication](https://docs.computesdk.com/platform/authentication.md) for details.

## Run

```bash
npx tsx hello.mts
```

Expect `hello` on stdout. The `finally` block attempts cleanup even if command execution fails. If cleanup fails, destroy the sandbox through the dashboard or CLI. Closing the Node.js process does not stop billing.

## Choose a provider

To select Modal for this example, replace the create call with:

```typescript
const sandbox = await compute.instances.create({ providerOrder: ['modal'] });
```

This explicit order uses your organization's connected Modal key and bypasses the organization's saved router. Keep the same command and `finally` cleanup. Omit the override to use saved routing, including managed compute. See [SDK provider selection](https://docs.computesdk.com/interfaces/sdk.md#choose-a-provider) for fallback orders and the current managed-provider selection options.

## Next steps

* [TypeScript SDK overview](https://docs.computesdk.com/interfaces/sdk.md)
* [Commands, files and create options](https://docs.computesdk.com/sandboxes/sandboxes.md)
* [Errors, limits and safe retries](https://docs.computesdk.com/interfaces/sdk/errors.md)
* [SDK reference](https://docs.computesdk.com/interfaces/sdk/reference.md)
* [Routing and billing](https://docs.computesdk.com/platform/routing.md)

This example requires a release containing the built-in router. For older versions, see [SDK compatibility](https://docs.computesdk.com/interfaces/sdk/reference.md#compatibility).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.computesdk.com/interfaces/sdk/sdk-quick-start.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
