openalex is a human-friendly and agent-friendly CLI for the OpenAlex API. It is designed for fast literature lookup, citation tracing, author/institution discovery, and field projection without forcing users into raw JSON by default.
Choose the path that matches your environment:
- skill-aware agents: install the repo skill with
npx skills add - local shell or plain CLI use: install the npm package and run
openalex
Install the openalex skill from this repository:
npx skills add shiquda/openalex-skill --skill openalexThis installs the skill instructions, not the CLI binary itself. You still need the openalex command available, either by installing the npm package below or by letting your agent finish the setup steps in the skill guide.
If your environment does not support repo-distributed skills yet, install the CLI directly:
npm install -g openalex-skill
openalex --help- human-readable output by default
- targeted extraction with
--field - server-side narrowing with
--selectwhen OpenAlex supports it - works, authors, sources, institutions, topics, publishers, funders, and concepts
- helper flows for
related,cited-by, andreferences - built-in single-work full-text download when OpenAlex exposes a direct file URL
- bare DOI input accepted everywhere (
10.xxxx/...,doi:..., full URL all work) --allfor automatic cursor pagination across any list command--format bibtexfor direct citation export from works- automatic retry with backoff on
429and server errors
npm install -g openalex-skill
openalex --help
openalex --version
openalex works search "llm agents" --per-page 5
openalex works search "llm agents" --all --format jsonl
openalex works get https://doi.org/10.1038/nature12373
openalex works get 10.1038/nature12373
openalex works download https://doi.org/10.1038/nature12373
openalex works cited-by doi:10.1038/nature12373 --per-page 5Optional but recommended for higher quotas:
openalex config set api-key your_key_here
openalex config showSearch papers:
openalex works search "retrieval augmented generation" --per-page 5Get a work by DOI or OpenAlex ID:
openalex works get https://doi.org/10.1038/nature12373
openalex works get 10.1038/nature12373
openalex works get W2741809807Download the best available direct full-text file for one work:
openalex works download https://doi.org/10.1038/nature12373
openalex works download 10.1038/nature12373
openalex works download W2741809807 --output ./nature12373.pdfTrace citations:
openalex works cited-by https://doi.org/10.1038/nature12373 --per-page 5
openalex works cited-by 10.1038/nature12373 --per-page 5
openalex works references W2741809807 --per-page 5
openalex works related W2741809807 --per-page 5cited-by, references, and related accept either a DOI or an OpenAlex work ID.
Find authors and their works:
openalex authors search "Geoffrey Hinton" --per-page 3
openalex authors get https://orcid.org/0000-0002-3141-5845
openalex works list --filter author.id:A5070829652 --per-page 5Group and analyze:
openalex works group --by publication_year --filter author.id:A5070829652
openalex rate-limitDefault output is summary, which is optimized for both humans and agents.
Available formats:
summary- concise, readable, high-signal outputdetail- readable structured output without transport noisejson- full structured payloadjsonl- one JSON object per linemarkdown- heading plus JSON blockbibtex- BibTeX entries for work records
In summary, entity rows keep the human-readable title on the first line and include reusable identifiers such as OpenAlex IDs on the secondary line when available.
Quick examples:
openalex works search "crispr" --per-page 3
openalex --format detail works get W2741809807
openalex works search "crispr" --all --format jsonl
openalex works get 10.1038/nature12373 --format bibtexUse --field for client-side projection after the response arrives:
openalex works fields
openalex works get W2741809807 \
--format detail \
--field title \
--field abstract \
--field authorships.author.display_nameUse --select for server-side field selection when OpenAlex supports it:
openalex works search "crispr" \
--select id \
--select title \
--select cited_by_countImportant --select caveats:
- OpenAlex only supports selecting root-level fields
groupandautocompletedo not support--selectabstractandabstract_inverted_indexare not selectable upstream- if you need abstract text, prefer
--field abstractand avoid--selectfor that request
OPENALEX_API_KEY- recommended for search and higher-volume useOPENALEX_BASE_URL- defaults tohttps://api.openalex.orgOPENALEX_MAILTO- optional contact email
Example:
Bash:
export OPENALEX_API_KEY=your_key_here
openalex works search "graph neural networks" --per-page 5PowerShell:
$env:OPENALEX_API_KEY="your_key_here"
openalex works search "graph neural networks" --per-page 5openalex can also store user-level settings in ~/.openalex-skill/config.json.
Priority order:
- environment variables override stored config
- stored config overrides built-in defaults
Useful commands:
openalex config
openalex config show
openalex config path
openalex config set api-key your_key_here
openalex config unset api-key- Use
--allon list-style commands to auto-follow cursor pagination until OpenAlex stops returningnext_cursor --alluses cursor pagination and cannot be combined with--page- transient upstream failures such as
429and503are retried automatically with backoff
Examples:
openalex works search "llm agents" --all --per-page 200 --format jsonl
openalex works cited-by 10.1038/nature12373 --all --per-page 100worksfilters pass straight through to OpenAlex; the CLI does not rename filter fields for youauthorsinstitution examples uselast_known_institutions.id:I123456worksinstitution-related filters depend on the OpenAlex field path you want to target, so prefer verifying with--format jsonif a filter returns no rows
This repository also includes an installable skill definition under skills/openalex/. Skill-specific operational guidance lives in skills/openalex/SKILL.md.
npm install
npm run build
npm exec --package=. openalex -- --help
npm test
npm run typecheck
npm run pack:dry-runOfficial OpenAlex resources:
- API docs: https://docs.openalex.org
- LLM quick reference: https://docs.openalex.org/api-guide-for-llms
- Official bulk-download CLI: https://github.com/ourresearch/openalex-official
- API key signup: https://openalex.org/settings/api
Use openalex-official for large bulk-download workflows. Use openalex for interactive querying, lookup, single-work download, citation tracing, grouping, and field projection.