doi2bib
Resolve a DOI to its BibTeX entry using the doi.org content negotiation endpoint.
Input
If no DOI is provided, ask the user for one. Accept either the bare DOI
(10.1038/nature12373) or a full URL (https://doi.org/10.1038/nature12373);
strip the URL prefix before making the request.
How to Use
curl -s -L --max-time 10 -H "Accept: text/bibliography; style=bibtex" "https://doi.org/<DOI>"
-Lfollows the redirect from doi.org to the publisher's Crossref/DataCite record.--max-time 10caps the request so a stalled publisher endpoint doesn't block the agent turn.- The
Acceptheader asks the resolver to return a BibTeX-formatted citation instead of the landing page. - Quote the URL to protect any
∨characters in the DOI.
Output
Return the raw BibTeX verbatim inside a ```bibtex code block so the user can
paste it straight into a .bib file. Do not reformat the entry or rename the
citation key unless the user asks.
Error handling
If the response is empty, an HTML page, or a curl error, tell the user the DOI could not be resolved and show what came back so they can diagnose (typo, unregistered DOI, publisher not supporting BibTeX negotiation).