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

# Installation

> Install and configure the Tracia SDK

## Installation

Install the Tracia SDK using your preferred package manager:

<CodeGroup>
  ```bash npm theme={null}
  npm install tracia
  ```

  ```bash pnpm theme={null}
  pnpm add tracia
  ```

  ```bash yarn theme={null}
  yarn add tracia
  ```
</CodeGroup>

## Requirements

* Node.js 18+ (uses native `fetch`)
* Works in modern browsers with native `fetch` support

## Configuration

Initialize the Tracia client with your API key:

```typescript theme={null}
import { Tracia } from 'tracia';

const tracia = new Tracia({
  apiKey: process.env.TRACIA_API_KEY
});
```

### Configuration Options

| Option        | Type                                     | Required | Description                                      |
| ------------- | ---------------------------------------- | -------- | ------------------------------------------------ |
| `apiKey`      | `string`                                 | Yes      | Your Tracia API key (starts with `tr_`)          |
| `onSpanError` | `(error: Error, spanId: string) => void` | No       | Callback for background span submission failures |

### Environment Variables

We recommend storing your API key in environment variables:

```bash .env theme={null}
TRACIA_API_KEY=tr_your_api_key_here
```

<Warning>
  Never commit API keys to version control. Use environment variables or a secrets manager.
</Warning>

## TypeScript Support

The SDK is written in TypeScript and exports all types:

```typescript theme={null}
import {
  Tracia,
  TraciaOptions,
  TraciaSession,
  RunOptions,
  RunResult,
  TokenUsage,
  Prompt,
  PromptListItem,
  PromptMessage,
  MessageRole,
  CreatePromptOptions,
  UpdatePromptOptions,
  TraciaError,
  TraciaErrorCode,
  // runLocal types
  LocalPromptMessage,
  RunLocalInput,
  RunLocalResult,
  LocalStream,
  LLMProvider,
  // Span types
  Span,
  SpanListItem,
  SpanStatus,
  ListSpansOptions,
  ListSpansResult,
  // Tool types
  ToolDefinition,
  ToolCall,
  ToolChoice,
} from 'tracia';
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Prompts SDK" icon="code" href="/sdk-node/prompts">
    Manage and run prompts stored in Tracia
  </Card>

  <Card title="Run Local" icon="bolt" href="/sdk-node/run-local">
    Execute prompts directly against LLM providers
  </Card>
</CardGroup>
