Skip to main content

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

Install the SDK

Install the docexdev package using your preferred package manager:
npm install docexdev
2

Run docex setup

The setup command authenticates via GitHub, provisions a wallet, and returns an API key:
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.
3

Configure environment variables

Export the values returned from setup:
export DOCEX_API_KEY="dx_live_..."
export DOCEX_BASE_URL="https://api.docex.dev"
Never commit your API key to source control. Use environment variables or a secrets manager.
4

Run your first analysis

Call docex.run() with a file path and a prompt describing what you want to analyze:
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);
5

Verify the response

A successful call returns a run envelope:
{
  "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).
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 for details.