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

# TypeScript quickstart

> Wrap your OpenAI, Anthropic, or Google Gen AI client and send your first usage event.

Use `@brello/sdk` in a server-side Node.js application. You need Node.js 18 or newer, a Brello project ingestion key, and credentials for your AI provider. Follow your provider SDK's Node.js requirements as well.

## Install the SDK

Install the Brello SDK in your application directory:

```bash theme={null}
npm install @brello/sdk
```

To test from source, run `pnpm install` and `pnpm pack` in the SDK's `typescript` directory. From your application directory, run `npm install` with the tarball path printed by `pnpm pack`.

Keep your existing provider SDK dependency. For Google AI Studio or Vertex AI, install `@google/genai` if your application doesn't already use it.

## Set your Brello environment

```bash theme={null}
export BRELLO_API_KEY="YOUR_BRELLO_PROJECT_KEY"
```

The SDK uses `https://api.brello.app/v1` by default. If you run Brello yourself, [set your self-hosted API URL](https://docs.brello.app/sdk/typescript/configuration.md#connect-to-self-hosted-brello). Configure your provider credentials separately in your application.

## Wrap your client

Choose the client you already use. Create one Brello instance per application runtime so calls share a buffer.

```ts OpenAI theme={null}
import { Brello } from '@brello/sdk';
import OpenAI from 'openai';

const brello = new Brello();
export const openai = brello.wrap(new OpenAI());
```

```ts Anthropic theme={null}
import { Brello } from '@brello/sdk';
import Anthropic from '@anthropic-ai/sdk';

const brello = new Brello();
export const anthropic = brello.wrap(new Anthropic());
```

```ts Google AI Studio theme={null}
import { Brello } from '@brello/sdk';
import { GoogleGenAI } from '@google/genai';

const brello = new Brello();
const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
export const gemini = brello.wrap(client, { provider: 'google_ai_studio' });
```

```ts Vertex AI theme={null}
import { Brello } from '@brello/sdk';
import { GoogleGenAI } from '@google/genai';

const brello = new Brello();
const client = new GoogleGenAI({
  vertexai: true,
  project: process.env.GOOGLE_CLOUD_PROJECT,
  location: process.env.GOOGLE_CLOUD_LOCATION,
});
export const gemini = brello.wrap(client, { provider: 'google_vertex_ai' });
```

Keep your existing provider calls. For setup and request examples, see the [OpenAI](https://docs.brello.app/sdk/typescript/openai.md), [Anthropic](https://docs.brello.app/sdk/typescript/anthropic.md), or [Google AI Studio and Vertex AI](https://docs.brello.app/sdk/typescript/google.md) guide.

## Verify the connection

Complete a provider call or finish consuming its stream. In Brello, open your project's **Settings** and look for **Connected** under SDK activity. That status appears after the worker stores an event. For a short-lived test script, call `await brello.flush()` before it exits.

If the status stays pending, check your [project key](https://docs.brello.app/sdk/guides/authentication.md) and set `BRELLO_DEBUG=1` to inspect event delivery. See [configuration and delivery](https://docs.brello.app/sdk/typescript/configuration.md) for context, retries, and serverless examples.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.