Files
jackwener__opencli/docs/adapters/browser/openalex.md
jakevin 498ad3930c feat: 13 read adapters across 6 new sites (round 4) (#1347)
Six new public-API sites — package registries + Docker images + OpenAlex
scholarly works — all unauthenticated, no browser required.

  dockerhub  search image
  rubygems   search gem
  homebrew   formula cask popular
  packagist  search package
  maven      search artifact
  openalex   search work

Conventions held:
  - access: 'read' on every command
  - typed errors (ArgumentError / EmptyResultError / CommandExecutionError)
    instead of generic CliError or silent fallback
  - input validators per site (image slugs, gem names, Composer names,
    Maven coordinates, OpenAlex work-id / DOI normalization)
  - listing rows carry an id-shaped column (image / gem / token / package /
    coordinate / id) that round-trips into the corresponding detail command
  - HTTP 429 surfaces with retry hint, 404 → EmptyResultError

Audits:
  - check:typed-error-lint   → no new violations (baseline 196)
  - check:silent-column-drop → no new violations (baseline 103)
  - advise:listing-id-pairing → unchanged at 13
2026-05-06 13:38:43 +08:00

2.6 KiB

OpenAlex

Mode: 🌐 Public · Domain: api.openalex.org

Search and inspect scholarly Works (papers, preprints, books) on OpenAlex without auth or browser. Two commands.

Commands

Command Description
opencli openalex search <query> Search OpenAlex Works by keyword
opencli openalex work <id> Single Work — metadata + reconstructed abstract

Usage Examples

# Free-text search
opencli openalex search transformers --limit 10
opencli openalex search "open access scholarly" --limit 5

# Single Work by OpenAlex id (use `id` from search rows)
opencli openalex work W2741809807

# Single Work by DOI (raw or full URL)
opencli openalex work 10.7717/peerj.4375
opencli openalex work https://doi.org/10.7717/peerj.4375

# JSON output
opencli openalex search transformers -f json
opencli openalex work W2741809807 -f json

Output Columns

Command Columns
search rank, id, title, year, citations, firstAuthor, venue, openAccess, type, doi, url
work id, title, type, year, date, language, authors, venue, citations, openAccess, openAccessUrl, referencedCount, doi, abstract, url

The id column from search round-trips into work exactly. work accepts an OpenAlex Work id, a raw DOI, or any openalex.org / doi.org URL.

Options

Option Description
query (positional) Search text
--limit Max Works (1-200, default: 20)

openalex work

Option Description
id (positional) OpenAlex Work id (W2741809807), DOI (10.7717/peerj.4375), or full URL

Caveats

  • Work id input is validated upfront — only W… IDs / DOIs / openalex.org / doi.org URLs are accepted; OpenAlex itself does the canonicalization for DOIs. Bad input raises ArgumentError.
  • The abstract column is reconstructed from OpenAlex's abstract_inverted_index (token → positions) — this is how OpenAlex distributes abstracts for licensing reasons. It's the verbatim abstract text.
  • Set OPENALEX_MAILTO=you@example.com to opt into the OpenAlex polite pool (faster + more reliable). Optional — anonymous requests still work.
  • OpenAlex select= rejects unknown fields. The adapter pins a vetted field list (primary_location, open_access, authorships, etc.) to avoid passing aliases that 400.
  • OpenAlex throttles unauthenticated traffic; HTTP 429 surfaces as a typed CommandExecutionError with a retry hint.

Prerequisites

  • No browser required — uses api.openalex.org/works.