Skip to main content

A CLI for Semantic Scholar API - designed for humans and AI agents

Project description

s2cli - Semantic Scholar CLI

A command-line interface for the Semantic Scholar API, designed for both human researchers and AI agents.

Installation

pip install s2cli

Or with uv:

uv pip install s2cli

Quick Start

Run directly without installing using uvx:

uvx s2cli search "attention mechanism transformers"

Or after installing:

# Search for papers (shows table in terminal)
s2cli search "attention mechanism transformers"

# Get paper details
s2cli paper ARXIV:1706.03762

# Export BibTeX
s2cli bibtex ARXIV:1706.03762 >> references.bib

# Get papers citing this paper
s2cli citations 204e3073870fae3d05bcbc2f6a8e263d9b72e776

# Get paper recommendations
s2cli recommend 204e3073870fae3d05bcbc2f6a8e263d9b72e776

Output Formats

s2cli is designed to work seamlessly for both humans and AI agents:

Context Default Output Behavior
Terminal (interactive) Human-readable table Easy to scan and read
Piped to another command Compact JSON Machine-parseable for scripts
--json flag Pretty JSON Explicit JSON when you need it
--bibtex / -b flag BibTeX Ready for LaTeX
# Terminal: shows a nice table
s2cli search "transformers"

# Piped: automatically outputs JSON for jq, scripts, AI agents
s2cli search "transformers" | jq '.results[0].title'

# Explicit JSON (pretty-printed in terminal)
s2cli search "transformers" --json

# BibTeX output
s2cli search "transformers" --bibtex

Commands

Paper Commands

Command Description
s2cli search <query> Search papers by keyword
s2cli paper <id>... Get paper details (batch supported)
s2cli citations <id> Get papers citing this paper
s2cli references <id> Get papers cited by this paper
s2cli recommend <id> Get paper recommendations
s2cli bibtex <id>... Export BibTeX only

Author Commands

Command Description
s2cli author get <id> Get author details
s2cli author search <name> Search authors by name
s2cli author papers <id> Get author's papers

Dataset Commands

Command Description
s2cli datasets List available dataset releases
s2cli dataset <release> Get dataset info

Search Filters

# Filter by year
s2cli search "LLM" --year 2023
s2cli search "LLM" --year 2020-2024

# Filter by minimum citations
s2cli search "attention" --min-citations 1000

# Only open access papers
s2cli search "BERT" --open-access

# Filter by venue
s2cli search "vision" --venue "CVPR,ICCV"

# Combine filters
s2cli search "transformers" --year 2022- --min-citations 500 --open-access

Examples

Human Workflows

# Find influential papers on a topic
s2cli search "large language models" --min-citations 1000

# Get all papers by an author
s2cli author papers 1741101 --limit 50

# Export bibliography for a set of papers
s2cli bibtex paper1 paper2 paper3 > refs.bib

# Explore citation network
s2cli citations 204e3073870fae3d05bcbc2f6a8e263d9b72e776 --limit 20

AI Agent / Scripting Workflows

# Quick context gathering (auto-JSON when piped)
s2cli search "retrieval augmented generation" | jq '.results[:3]'

# Batch lookup with specific fields
s2cli paper id1 id2 id3 --fields paperId,title,year,citationCount

# Get top cited paper
s2cli search "NLP" --min-citations 5000 --limit 1 | jq '.results[0]'

# Extract just titles
s2cli search "vision transformers" | jq -r '.results[].title'

Paper ID Formats

The CLI accepts various paper ID formats:

  • Semantic Scholar ID: 204e3073870fae3d05bcbc2f6a8e263d9b72e776
  • DOI: DOI:10.18653/v1/N18-3011 or 10.18653/v1/N18-3011
  • arXiv: ARXIV:1706.03762 or arXiv:1706.03762
  • CorpusId: CorpusId:215416146
  • PubMed: PMID:123456

Configuration

Set your API key for higher rate limits:

export S2_API_KEY=your_key_here

Or pass it directly:

s2cli search "query" --api-key your_key_here

Design Philosophy

Based on CLI best practices and GitHub CLI patterns:

  1. Human-first by default - Tables and readable output in terminals
  2. Machine-friendly when piped - Automatic JSON for scripts and AI agents
  3. Explicit overrides - --json and --bibtex flags when you need control
  4. BibTeX included - Every paper result can include a citation

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

s2cli-0.1.1.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

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

s2cli-0.1.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file s2cli-0.1.1.tar.gz.

File metadata

  • Download URL: s2cli-0.1.1.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for s2cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 85c31cc2e9c63f1a2b95c19aa5f295df7e67a57363efaa104c33e09166662678
MD5 f20cc55b06c45ffed2d60ed34760a3ab
BLAKE2b-256 129ab8a05277d06999ee2bd70e509682c1ae402a91340691f7e49c8c53ecb553

See more details on using hashes here.

File details

Details for the file s2cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: s2cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for s2cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de01bb211fb05e77627cbdd62a74bf8411da5c8d9bd644fbf2f9e0c09cf64b42
MD5 88760350e279a172dccb7e93d71b7cdc
BLAKE2b-256 bcf3243c6864fd21291cbbc2a4ee09b948531ace59eba4c45f2cfb0ffe5152b2

See more details on using hashes here.

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