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

# Install the FileRouter TypeScript SDK

> Install @file_router/sdk with npm, yarn, or pnpm. Requires Node.js ≥ 22.14.0. Optional peer dependencies are only needed for direct BYOK mode.

The FileRouter TypeScript SDK is published as `@file_router/sdk` on npm. It gives you a single, provider-neutral API for document parsing — either through the hosted FileRouter service or directly with your own provider keys. Before you install, make sure you're running **Node.js 22.14.0 or later**.

## Install the package

Choose your preferred package manager and run one of the commands below.

<CodeGroup>
  ```bash npm theme={null}
  npm install @file_router/sdk
  ```

  ```bash yarn theme={null}
  yarn add @file_router/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @file_router/sdk
  ```
</CodeGroup>

## Optional peer dependencies

By default, `@file_router/sdk` has no peer dependencies that you need to install manually. The optional packages below are only required when you use **direct BYOK mode** and want to call LlamaParse or Mistral OCR with your own API keys. If you only use the hosted `FileRouterClient`, you can skip this section entirely.

<CardGroup cols={2}>
  <Card title="LlamaParse" icon="file-lines">
    Required when you instantiate the `llamaparse()` adapter from `@file_router/sdk/llamaparse`.

    ```bash npm theme={null}
    npm install @llamaindex/llama-cloud
    ```
  </Card>

  <Card title="Mistral OCR" icon="eye">
    Required when you instantiate the `mistralOcr()` adapter from `@file_router/sdk/mistral`.

    ```bash npm theme={null}
    npm install @mistralai/mistralai
    ```
  </Card>
</CardGroup>

<Note>
  Datalab does not require an additional peer dependency — the `datalab()` adapter communicates directly with the Datalab API over HTTP.
</Note>

## Sub-path exports

The SDK ships several focused entry points so you only import what you need. Tree-shaking removes anything you don't use.

| Import path                   | What it provides                                                   |
| ----------------------------- | ------------------------------------------------------------------ |
| `@file_router/sdk`            | `FileRouter`, `FileRouterClient`, `FileRouterError`, and all types |
| `@file_router/sdk/llamaparse` | `llamaparse()` provider adapter                                    |
| `@file_router/sdk/mistral`    | `mistralOcr()` provider adapter                                    |
| `@file_router/sdk/datalab`    | `datalab()` provider adapter                                       |
| `@file_router/sdk/inspect`    | `inspectDocument()` MIME inspection utility                        |
| `@file_router/sdk/catalog`    | `builtInProviders()` convenience factory                           |
| `@file_router/sdk/testing`    | Test helpers and mock providers                                    |

## Your first import

Once the package is installed, import `FileRouterClient` from the main entry point and you're ready to make your first parse call.

```ts client.ts theme={null}
import { FileRouterClient } from '@file_router/sdk'

const client = new FileRouterClient()
```

<Tip>
  `FileRouterClient` automatically reads your `FILEROUTER_API_KEY` environment variable, so you don't need to pass the key explicitly in most setups. See [Hosted Client](/sdk/hosted-client) for the full constructor reference.
</Tip>
