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

# Providers

> Docex routes images and PDFs through an abstraction layer around external AI APIs. The catalog describes capabilities, costs, and auth requirements. The planner resolves candidates. The executor runs strategies with automatic fallback.

# Providers

> Providers are adapters around external APIs. The catalog describes capabilities, costs, and auth requirements. The planner resolves candidates per step. The executor runs strategies with automatic fallback.

## Supported providers

| Provider        | Capability                                   | Best for                                     |
| --------------- | -------------------------------------------- | -------------------------------------------- |
| **OpenRouter**  | Gateway for multimodal vision models         | Flexibility, model switching                 |
| **Mistral OCR** | OCR engine for image and PDF text extraction | High-accuracy text extraction from documents |
| **Mock**        | Deterministic local responses                | CI testing, offline development              |

## Internal model catalogue

Docex keeps model selection internal. The catalogue is used by the planner for OpenRouter and
Mistral OCR routing, default model selection, capability checks, timeouts, and pricing hints. It is
not exposed as a public model marketplace.

## Provider catalog

The catalog (`catalog.js`) defines each provider's:

* **Capabilities** — supported input types, output formats, max file size
* **Cost model** — per-request or per-token pricing
* **Auth requirements** — API key, OAuth, or none
* **Defaults** — which model to try first for each provider class

## Automatic fallback

If a provider fails (network error, rate limit, invalid response), the executor automatically retries with the next candidate in the plan. This happens transparently to the caller.

## Mock provider

The mock provider is enabled by default in development and testing. It returns deterministic fixture responses based on file name patterns without calling external APIs or deducting wallet balance.

<Note>
  In `NODE_ENV=production` or when `DOCEX_PROVIDER_MODE=managed`, the mock provider is disabled unless `DOCEX_ALLOW_MOCK_PROVIDER=1` is explicitly set.
</Note>

## Provider mode

| Mode      | Behavior                                                             |
| --------- | -------------------------------------------------------------------- |
| `default` | Mock provider available, real providers used if configured           |
| `managed` | Mock provider disabled, only authenticated real providers are routed |

Set via the `DOCEX_PROVIDER_MODE` environment variable.
