> ## 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.

# BYOK Mode: Use Your Own Provider API Keys with the CLI

> Use the --local flag to bypass the hosted FileRouter service and call LlamaParse, Mistral OCR, or Datalab directly with your own provider API keys.

BYOK (Bring Your Own Key) mode lets you use the FileRouter CLI without a FileRouter account. Add `--local` to any `parse` or `compare` command, set the appropriate provider environment variable, and the CLI calls the provider's API directly — your document and key never pass through the hosted FileRouter service.

## How it works

By default, the CLI routes requests through the hosted FileRouter service using the API key you created with `filerouter login`. When you pass `--local`, the CLI skips that entirely and connects straight to the provider you specify. The same output formats and comparison features work exactly as they do in hosted mode.

<Info>
  You don't need a FileRouter account or API key to use `--local` mode. The only credential required is the one for your chosen provider.
</Info>

## Provider environment variables

Set the environment variable for each provider you want to use:

<CardGroup cols={3}>
  <Card title="LlamaParse" icon="file-lines">
    `LLAMA_CLOUD_API_KEY`
  </Card>

  <Card title="Mistral OCR" icon="eye">
    `MISTRAL_API_KEY`
  </Card>

  <Card title="Datalab" icon="database">
    `DATALAB_API_KEY`
  </Card>
</CardGroup>

Export the variable in your shell, store it in a `.env` file that your shell loads at startup, or pass it inline on the command line.

## Parse with `--local`

Pass `--local` to the `parse` command along with your provider API key:

<CodeGroup>
  ```bash LlamaParse theme={null}
  export LLAMA_CLOUD_API_KEY=your_llama_key
  npx @file_router/cli parse report.pdf --local
  ```

  ```bash Mistral OCR theme={null}
  export MISTRAL_API_KEY=your_mistral_key
  npx @file_router/cli parse report.pdf --provider mistral-ocr --local
  ```

  ```bash Datalab theme={null}
  export DATALAB_API_KEY=your_datalab_key
  npx @file_router/cli parse report.pdf --provider datalab --local
  ```
</CodeGroup>

You can pass the variable inline without exporting it first:

```bash theme={null}
LLAMA_CLOUD_API_KEY=your_llama_key npx @file_router/cli parse report.pdf --local
```

<Tip>
  Inline variables are scoped to the single command invocation — they don't persist in your shell session. This is useful for quick one-off runs or CI pipelines where you want to keep keys out of your environment.
</Tip>

## Compare with `--local`

The `compare` command supports `--local` too. Every provider in the comparison uses its own environment variable:

<CodeGroup>
  ```bash Compare all providers locally theme={null}
  export LLAMA_CLOUD_API_KEY=your_llama_key
  export MISTRAL_API_KEY=your_mistral_key
  export DATALAB_API_KEY=your_datalab_key
  npx @file_router/cli compare report.pdf --local
  ```

  ```bash Compare two providers locally theme={null}
  export LLAMA_CLOUD_API_KEY=your_llama_key
  export MISTRAL_API_KEY=your_mistral_key
  npx @file_router/cli compare report.pdf --providers llamaparse,mistral-ocr --local
  ```
</CodeGroup>

## File size limits

<Warning>
  In `--local` mode, file size limits depend entirely on the provider you're calling — not on the FileRouter service. The hosted service enforces a 100 MB ceiling, but each provider sets its own limits when you contact them directly. Check your provider's documentation for their current upload restrictions.
</Warning>

## Full example

Here's a complete end-to-end example that parses a PDF with LlamaParse in local mode and saves the result as JSON:

```bash theme={null}
LLAMA_CLOUD_API_KEY=your_llama_key \
  npx @file_router/cli parse report.pdf \
  --local \
  --json \
  --out result.json
```
