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

# Get started in 5 minutes

> Get Claude working in 5 minutes with a single TypeScript file

# Quickstart

Get Claude working in your application with a single TypeScript file.

## Prerequisites

* Node.js 18 or later
* A Chucky account ([sign up free](https://app.chucky.cloud))
* Your **Project ID** and **HMAC secret** from [project settings](https://app.chucky.cloud/project/settings)

## 1. Create Your Project

Create a new directory and install the SDK:

```bash theme={null}
mkdir my-chucky-app && cd my-chucky-app
npm init -y
npm install @chucky.cloud/sdk
npm install -D tsx typescript @types/node
```

## 2. Set Your Credentials

```bash theme={null}
export CHUCKY_PROJECT_ID="your-project-id"
export CHUCKY_HMAC_SECRET="your-hmac-secret"
```

<Tip>Get these from your [project settings](https://app.chucky.cloud/project/settings)</Tip>

## 3. Create quickstart.ts

Create a file called `quickstart.ts`:

```typescript theme={null}
import {
  ChuckyClient,
  createToken,
  createBudget,
  getResultText,
} from '@chucky.cloud/sdk';

// Verify environment variables
const PROJECT_ID = process.env.CHUCKY_PROJECT_ID;
const HMAC_SECRET = process.env.CHUCKY_HMAC_SECRET;

if (!PROJECT_ID || !HMAC_SECRET) {
  console.error('Error: Missing required environment variables.');
  console.error('Please set CHUCKY_PROJECT_ID and CHUCKY_HMAC_SECRET');
  console.error('Get these from: https://app.chucky.cloud/project/settings');
  process.exit(1);
}

async function main() {
  console.log('Connecting to Chucky...');

  // Create a token (in production, do this server-side)
  const token = await createToken({
    userId: 'quickstart-user',
    projectId: PROJECT_ID,
    secret: HMAC_SECRET,
    expiresIn: 3600, // 1 hour
    budget: createBudget({
      aiDollars: 1.0, // $1 budget
      computeHours: 1,
      window: 'day',
    }),
  });

  // Create the Chucky client
  const client = new ChuckyClient({ token });

  try {
    // Send a prompt and get the result
    const result = await client.prompt(
      'What is 2 + 2? Answer with just the number.',
      { model: 'claude-sonnet-4-5-20250929' }
    );

    // Extract and print the result
    const text = getResultText(result);
    console.log('Claude:', text);
    console.log('Done! Session completed.');
  } catch (error) {
    console.error('Error:', error);
    throw error;
  } finally {
    // Always close the client to release resources
    client.close();
  }
}

main().catch((error) => {
  console.error('Fatal error:', error);
  process.exit(1);
});
```

## 4. Run It

```bash theme={null}
npx tsx quickstart.ts
```

### Expected Output

<Note>
  Output below is representative. Actual Claude responses and timing will vary based on the model's response.
</Note>

```
Connecting to Chucky...
Claude: 4
Done! Session completed.
```

## What Just Happened?

1. **Token creation** - The `createToken()` function generates a JWT that authenticates your user and sets their budget limits
2. **Client connection** - `ChuckyClient` connects to Chucky's secure WebSocket endpoint
3. **Prompt execution** - `client.prompt()` sends your message to Claude and returns the complete response
4. **Result extraction** - `getResultText()` extracts the text response from the result object
5. **Clean shutdown** - `client.close()` properly closes the connection

## Next Steps

<CardGroup cols={2}>
  <Card title="Multi-turn Conversations" icon="comments" href="/concepts/sessions">
    Build interactive chat experiences with session memory
  </Card>

  <Card title="Add Custom Tools" icon="wrench" href="/concepts/tools">
    Let Claude interact with your APIs and services
  </Card>

  <Card title="Authentication Deep Dive" icon="key" href="/authentication">
    Understand tokens, budgets, and security
  </Card>

  <Card title="Other Languages" icon="code" href="/sdks">
    Python, Go, and PHP SDK documentation
  </Card>
</CardGroup>
