npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@okrapdf/cli

v0.2.11

Published

OkraPDF command-line interface for PDF extraction and document chat

Readme

@okrapdf/cli

Command-line interface for OkraPDF - extract tables from PDFs.

npm version License: MIT

Installation

npm install -g @okrapdf/cli

Or use with npx:

npx @okrapdf/cli extract invoice.pdf

Quick Start

# Set your API key
export OKRA_API_KEY=okra_xxxxxxxxxxxx

# Extract tables from a PDF
okra extract invoice.pdf -o json

# Ask a question about a document
okra run report.pdf "What is the total revenue?"

Get your API key from okrapdf.com/settings/api-keys.

Configuration

The CLI looks for your API key in this order:

  1. OKRA_API_KEY environment variable
  2. .env file in current directory
  3. .okra file in current directory
  4. ~/.okra file in home directory
  5. ~/.config/okrapdf/config.json

Example .env or .okra file:

OKRA_API_KEY=okra_xxxxxxxxxxxx
OKRA_BASE_URL=https://okrapdf.com

Commands

Shortcuts (Most Common)

okra extract <file>          # Upload + extract + wait (all-in-one)
okra run <file> "question"   # Extract + ask question

Documents

okra docs list               # List all documents
okra docs upload <file>      # Upload a PDF
okra docs get <uuid>         # Get document details
okra docs delete <uuid>      # Delete a document

Jobs

okra jobs list               # List extraction jobs
okra jobs create <file>      # Create extraction job
okra jobs get <job-id>       # Get job status
okra jobs wait <job-id>      # Wait for completion
okra jobs results <job-id>   # Get extraction results

Tables

okra tables list <doc-uuid>  # List extracted tables
okra tables get <table-id>   # Get table content
okra tables export <id>      # Export to CSV/JSON

Interactive Chat

okra chat <document-uuid>    # Interactive document Q&A

Output Formats

All commands support -o, --output:

  • table (default) - Human-readable tables
  • json - Machine-readable JSON
  • csv - CSV format
# JSON for scripting
okra jobs list -o json | jq '.[].id'

# Quiet mode for piping
okra extract doc.pdf -o json -q > results.json

For AI Agents

The CLI is designed to be agent-friendly:

# Get tables as JSON (for building presentations, reports)
okra extract document.pdf --json --quiet

# Get document list as JSON for processing
okra docs list -o json | jq '.[].uuid'

# Extract with specific processor
okra jobs create document.pdf -p gemini --wait -o json

Environment Variables

| Variable | Description | |----------|-------------| | OKRA_API_KEY | API key (required) | | OKRA_BASE_URL | Custom API URL (for self-hosted) | | OKRA_OUTPUT_FORMAT | Default output format |

Examples

Batch Processing

for pdf in *.pdf; do
  okra extract "$pdf" -o json > "${pdf%.pdf}.json"
done

CI/CD Integration

# Extract and check for tables
RESULT=$(okra extract report.pdf -o json -q)
TABLE_COUNT=$(echo "$RESULT" | jq '.tables | length')
echo "Found $TABLE_COUNT tables"

Exit Codes

| Code | Meaning | |------|---------| | 0 | Success | | 1 | General error | | 2 | Invalid arguments | | 3 | Authentication error | | 4 | Resource not found | | 5 | Rate limited |

Development

git clone https://github.com/okrapdf/cli
cd cli
npm install
npm run build
npm link
okra --help

License

MIT - see LICENSE

Links