Skip to main content

Academic literature search, citation management, and PDF retrieval CLI

Project description

OpenCite

Academic literature search, citation management, and PDF retrieval CLI.

Searches Semantic Scholar, OpenAlex, and PubMed in parallel, deduplicates results, and supports BibTeX output, citation graph traversal, PDF retrieval, batch downloads, and PDF-to-markdown conversion.

Quick Start

Install and set up your API keys:

uv pip install opencite                # or: pip install opencite
opencite config init                   # creates ~/.opencite/config.toml

Add your API keys to ~/.opencite/config.toml or export them as environment variables:

export SEMANTIC_SCHOLAR_API_KEY=your_key
export PUBMED_API_KEY=your_key
export OPENALEX_API_KEY=your_key

Start searching:

opencite search "transformer attention mechanism"
opencite lookup 10.1038/nature12345
opencite canonical "deep learning" --min-citations 500
opencite cite 10.1038/nature12345
opencite pdf 10.1038/nature12345 -o paper.pdf --convert

[!NOTE] Claude Code plugin: Type /plugin, select "Add marketplace", enter neuromechanist/opencite, and restart. Then use /opencite or ask Claude directly.

[!TIP] PDF conversion: Install with uv pip install 'opencite[convert]' for markitdown and markit-mistral support.

Commands

search - Find papers

opencite search "query" [--max N] [--source all|openalex|s2|pubmed]
    [--year-from YYYY] [--year-to YYYY] [--oa-only]
    [--sort relevance|citations|year] [-f text|json|bibtex|csv] [-o FILE] [-v]

lookup - Look up papers by identifier

opencite lookup IDENTIFIER [IDENTIFIER ...] [--enrich] [--append-bib FILE]
    [-f text|json|bibtex] [-o FILE] [-v]

Accepts DOI, pmid:X, pmc:X, arxiv:X, S2 ID, or OpenAlex ID. Supports multiple IDs.

cite - Citation graph

opencite cite IDENTIFIER [--direction citing|references|both] [--max N]
    [--sort citations|year] [--min-citations N] [-f text|json|bibtex] [-o FILE]

canonical - Most-cited papers in a field

opencite canonical "topic" [--max N] [--year-from YYYY] [--min-citations N]
    [-f text|json|bibtex] [-o FILE]

pdf - Download PDF

opencite pdf IDENTIFIER [-o PATH] [--filename NAME] [--convert]
    [--converter auto|markitdown|mistral]

-o accepts a file path (e.g., paper.pdf) or directory. With --convert, also generates a markdown file alongside the PDF.

convert - PDF to markdown

opencite convert FILE.pdf [-o FILE] [--converter auto|markitdown|mistral]
    [--extract-images] [--images-dir DIR]

Auto mode uses markit-mistral when MISTRAL_API_KEY is set (better for math and complex layouts), otherwise falls back to markitdown (free, local).

batch-fetch - Batch download PDFs

opencite batch-fetch FILE [-o DIR] [--convert] [--concurrency N] [--summary FILE]
opencite batch-fetch --from-json FILE [options]
opencite batch-fetch --from-stdin [options]

Downloads PDFs for multiple papers with controlled concurrency. Supports text files (one ID per line), JSON files (array of DOIs or opencite search results), and stdin.

Example workflow:

# Search and save as JSON, then batch download with conversion
opencite search "tDCS motor cortex" --max 30 -f json -o results.json
opencite batch-fetch --from-json results.json --convert --summary report.json -o ./papers

ids - Convert between identifiers

opencite ids IDENTIFIER [IDENTIFIER ...] [-f text|json]

Converts between DOI, PMID, and PMCID using the NCBI ID Converter API.

config - Manage configuration

opencite config init    # create ~/.opencite/config.toml template
opencite config show    # display resolved config (keys masked)
opencite config path    # show config file location

Output Formats

All search/lookup/cite/canonical commands support -f/--format:

  • text (default) - human-readable output
  • json - structured JSON
  • bibtex - BibTeX entries for citation managers
  • csv - comma-separated values (search only)

Use -o/--output FILE to write to a file instead of stdout.

Installation

# uv (recommended)
uv pip install opencite
uv pip install 'opencite[convert]'     # with PDF conversion (markitdown + markit-mistral)

# pip
pip install opencite
pip install 'opencite[convert]'

# uvx (no install needed, runs from cache)
uvx opencite --version

For development:

git clone https://github.com/neuromechanist/opencite.git
cd opencite
uv sync --extra dev

Configuration

OpenCite supports TOML config, .env files, and environment variables.

opencite config init    # creates ~/.opencite/config.toml with template
opencite config show    # display resolved config (keys masked)
opencite config path    # show config file location

Config loading priority

Later sources override earlier ones:

  1. ~/.opencite/config.toml
  2. ~/.opencite/.env
  3. .env in working directory
  4. Environment variables

API keys

Required for academic database access:

export SEMANTIC_SCHOLAR_API_KEY=your_key
export PUBMED_API_KEY=your_key
export OPENALEX_API_KEY=your_key

Optional:

export MISTRAL_API_KEY=your_key        # for PDF-to-markdown via Mistral OCR

Publisher tokens (optional)

For authenticated PDF downloads from paywalled publishers:

export ELSEVIER_API_KEY=your_key       # Elsevier/ScienceDirect
export WILEY_TDM_TOKEN=your_token      # Wiley TDM
export SPRINGER_API_KEY=your_key       # Springer Nature

These can also be set in ~/.opencite/config.toml:

[publishers]
elsevier = "your_key"
wiley_tdm = "your_token"
springer = "your_key"

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opencite-0.2.2.tar.gz (67.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencite-0.2.2-py3-none-any.whl (48.6 kB view details)

Uploaded Python 3

File details

Details for the file opencite-0.2.2.tar.gz.

File metadata

  • Download URL: opencite-0.2.2.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for opencite-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9fa3959c7d6ad64ffdcf851022bb9acb7bac2c715c157c0a25becec0d08df8e2
MD5 eb7db79b669148b265a27716298174da
BLAKE2b-256 a9e3da8c3ae52d7d03d3bc6c8aa97a40a1c7febb3ec660240fc5816b0fcf5415

See more details on using hashes here.

Provenance

The following attestation bundles were made for opencite-0.2.2.tar.gz:

Publisher: publish.yml on neuromechanist/opencite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opencite-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: opencite-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 48.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for opencite-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b370357893ee4f0ba0a8d24a7d12528f46785fd18275c31171071979fafc7d2
MD5 749f20bf792f6798b8d60b1c40c43db2
BLAKE2b-256 2f1d9972458e5c3ffcb13e19c962ecfff025462d39aeeba498bc981f711ccd0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for opencite-0.2.2-py3-none-any.whl:

Publisher: publish.yml on neuromechanist/opencite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page