Skip to main content

Install

npm install -g @okrapdf/cli
The package installs the okra binary. For one-off usage:
npx @okrapdf/cli --help

Authenticate

export OKRA_API_KEY=okra_sk_YOUR_KEY

okra auth set-key "$OKRA_API_KEY"
okra auth status

Upload a PDF

okra upload ./report.pdf
okra upload https://example.com/report.pdf

Ask a question

okra chat "What is total revenue?" --doc doc-abc123

Extract structured data

okra extract ./invoice.pdf \
  --schema ./invoice.schema.json \
  --prompt "Extract vendor, total, currency, and due date"

Read markdown

okra read doc-abc123 --pages 1-3

Machine and agent output

When stdout is not a TTY, most okra commands automatically emit a structured JSON envelope. You can also force this in an interactive terminal with --json:
okra context resolve "https://example.com/report.pdf" --json
okra extract ./invoice.pdf --schema ./schema.json --json
The envelope returns a uniform success/failure shape with ok, result, cost, citations, and next_actions. See the CLI Reference for the full envelope contract, stable error codes, and agent stop-gate rules.

What’s next

Extract

Structured extraction flags and examples.

Chat

Ask questions against a processed document.

Collections

Query across multiple documents.

Reference

Auth, environment variables, and global flags.