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

# Quickstart

> Authenticate with GitHub, top up your wallet, get an API key, and run your first vision analysis — from zero to results in minutes.

# Quickstart

> Authenticate with GitHub, top up your wallet, get an API key, and run your first vision analysis — from zero to results in minutes.

This guide walks you through the agent-first onboarding flow. By the end you will have a working API key and a successful `docex.run()` call.

<Steps>
  <Step title="Install the SDK">
    Install the `docexdev` package using your preferred package manager:

    <CodeGroup>
      ```bash npm theme={null}
      npm install docexdev
      ```

      ```bash yarn theme={null}
      yarn add docexdev
      ```

      ```bash pnpm theme={null}
      pnpm add docexdev
      ```
    </CodeGroup>
  </Step>

  <Step title="Run docex setup">
    The setup command authenticates via GitHub, provisions a wallet, and returns an API key:

    ```bash theme={null}
    npx docex setup --use-case "vision analysis for security scanning" --framework auto --top-up 5 --json
    ```

    The `--top-up` value is a USD wallet recharge amount. If you are running this as an agent, show the approval URL to the human and wait for them to approve the wallet recharge in the browser.
  </Step>

  <Step title="Configure environment variables">
    Export the values returned from setup:

    ```bash theme={null}
    export DOCEX_API_KEY="dx_live_..."
    export DOCEX_BASE_URL="https://api.docex.dev"
    ```

    <Warning>
      Never commit your API key to source control. Use environment variables or a secrets manager.
    </Warning>
  </Step>

  <Step title="Run your first analysis">
    Call `docex.run()` with a file path and a prompt describing what you want to analyze:

    ```js theme={null}
    import { createDocex } from "docexdev";

    const docex = createDocex({
      apiKey: process.env.DOCEX_API_KEY,
      baseUrl: process.env.DOCEX_BASE_URL,
    });

    const result = await docex.run({
      file: "./suspicious-email.png",
      prompt: "is_phishing, confidence_score, suspicious_elements, recommended_action",
    });

    console.log(result);
    ```
  </Step>

  <Step title="Verify the response">
    A successful call returns a run envelope:

    ```json theme={null}
    {
      "status": "completed",
      "schemaId": null,
      "protocolVersion": "0.1.0",
      "requests": 1,
      "outputFormat": "json",
      "result": {
        "is_phishing": true,
        "confidence_score": 0.94,
        "suspicious_elements": "urgent tone, mismatched sender domain, suspicious link",
        "recommended_action": "quarantine and alert security team"
      },
      "usage": {
        "requests": 1,
        "billableUnits": 1,
        "costUsd": 0.0321,
        "priceUsd": 0.0642
      },
      "chargedUsd": 0.0642,
      "confidence": 0.95,
      "metadata": {}
    }
    ```

    The `result` object reflects the fields you named in your prompt. The `usage` object shows the actual upstream cost and the billed price (2× markup by default).
  </Step>
</Steps>

<Note>
  **Testing in CI?** Use the mock provider to run end-to-end tests at zero cost. The mock provider returns realistic fixture responses without calling live models or deducting from your wallet. See the [CI testing guide](/concepts/providers#mock-provider) for details.
</Note>
