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

# Introduction

> Docex is agent-first vision and OCR infrastructure for runs with evidence, fallback, structured output, and cost visibility.

# Docex

> **Agent-first vision and OCR infrastructure.** Route any image or PDF through evidence capture, provider fallback, structured output, and cost visibility.

Docex accepts a file (image or PDF) plus a user prompt, classifies the task, selects an execution strategy, runs it through one or more AI providers, and returns structured JSON with confidence scores and usage-based billing.

## What makes Docex different

* **Task-agnostic pipeline** — Not limited to "documents." Analyze any image or PDF for any purpose: security scanning, data extraction, content moderation, visual QA.
* **Provider abstraction** — Automatic routing across OpenRouter, Mistral OCR, and mock providers with fallback if a provider fails.
* **Dynamic billing** — Pay a transparent markup on the actual upstream AI cost. No flat rates, no hidden fees.
* **Agent-first onboarding** — The entire setup flow (`docex setup`) is designed for AI agents, with human approval only at the payment boundary.

## How it works

<Steps>
  <Step title="Upload">
    Your app requests a presigned upload URL and uploads the file directly to storage.
  </Step>

  <Step title="Run">
    You call `POST /v1/runs` with the upload ID, a prompt, and optional schema or workflow hints.
  </Step>

  <Step title="Route">
    The worker classifies the task, selects a provider strategy, and estimates cost.
  </Step>

  <Step title="Execute">
    The executor runs the strategy. If a provider fails, it falls back to the next candidate automatically.
  </Step>

  <Step title="Receive">
    You poll or receive a structured run envelope with `result`, `confidence`, `usage`, and `chargedUsd`.
  </Step>
</Steps>

## Quick links

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Run `docex setup`, approve in the browser, and make your first API call in minutes.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/runs">
    Full reference for uploads, runs, polling, and error handling.
  </Card>

  <Card title="SDK & CLI" icon="terminal" href="/sdk-cli/installation">
    Install `docexdev`, configure your workspace, and run vision analysis from code or terminal.
  </Card>

  <Card title="Integrations" icon="plug" href="/integration/agent-playbook">
    Prompts and scaffolding for Codex, Claude Code, Cursor, and OpenCode agents.
  </Card>
</CardGroup>
