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

Published

OkraPDF command-line interface for PDF extraction and document chat

Downloads

425

Readme

@okrapdf/cli

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

Installation

npm install -g @okrapdf/cli

Or use with npx:

npx @okrapdf/cli jobs list

Quick Start

# Create a .env file with your API key
echo "OKRA_API_KEY=okra_xxxxxxxxxxxx" > .env

# Or create ~/.okra for global config
echo "OKRA_API_KEY=okra_xxxxxxxxxxxx" > ~/.okra

# List your documents
okra docs list

# List extraction jobs  
okra jobs list

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

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

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

Shortcuts

okra extract <file>          # Upload + extract + wait (all-in-one)

Interactive

okra chat <job-id>           # Interactive document chat
okra watch [job-ids...]      # Monitor live sessions in browser

Introspection

okra schema [command ...]    # Machine-readable command schema
okra exit-codes              # Stable exit codes for automation

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

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 | | OKRA_VERBOSE | Enable verbose diagnostics when set to 1 |

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/steventsao/okrapdf
cd okrapdf/packages/cli
npm install
npm run build
npm link
okra --help

License

MIT

Links