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

# Installation

> Install the FlexOrch TypeScript / JavaScript SDK.

```bash theme={null}
npm install flexorch-sdk
```

Requires Node.js 18+. Works with ESM and CommonJS.

***

## Setup

Set your API key as an environment variable:

```bash theme={null}
export FLEXORCH_API_KEY=dfx_your_key_here
```

The client picks it up automatically:

```typescript theme={null}
import { FlexOrchClient } from 'flexorch-sdk';

const client = new FlexOrchClient(); // reads FLEXORCH_API_KEY from env
```

Or pass it explicitly:

```typescript theme={null}
const client = new FlexOrchClient('dfx_your_key_here');

// options object form
const client = new FlexOrchClient({
  apiKey: 'dfx_your_key_here',
  timeout: 60,     // seconds — default 30
  maxRetries: 3,   // default 3
});
```

***

## CommonJS

```javascript theme={null}
const { FlexOrchClient } = require('flexorch-sdk');

const client = new FlexOrchClient();
```

***

## TypeScript types

All exports are fully typed. Import types alongside the client:

```typescript theme={null}
import { FlexOrchClient } from 'flexorch-sdk';
import type { ExportFormat } from 'flexorch-sdk';

const format: ExportFormat = 'jsonl'; // "json" | "jsonl" | "csv" | "parquet" | "md" | "xml" | "xlsx" | "rag"
```

***

## Verify

```typescript theme={null}
import { FlexOrchClient } from 'flexorch-sdk';

const client = new FlexOrchClient();
const usage = await client.usage.get();
console.log(usage.plan);                      // "trial"
console.log(usage.creditsUsed);               // 0
console.log(usage.creditsRemaining);          // 1200
```
