datasheet-cli
A command-line tool that extracts structured data from PDF datasheets using LLMs. Point it at a datasheet, get back JSON you can use in your tooling.
# Extract pinout data from a microcontroller datasheet
# Get PCB footprint dimensions
# Search Mouser for a part and download its datasheet
# Search JLCPCB parts library (no API key needed)
Why?
Every electronics engineer has done this: you're designing a PCB, you need the pinout for a new chip, and you spend 20 minutes scrolling through a 500-page PDF to find Table 12 buried on page 47. Then you manually transcribe it into your symbol editor, probably making a typo that you won't catch until after the boards are fabbed.
Datasheets are the lifeblood of hardware design, but they're trapped in PDFs that were designed for humans to read, not machines to parse. This tool uses Gemini's vision capabilities to extract the data you actually need:
- Pinout & configuration - Every pin with electrical type, alternate functions, and groupings
- Footprint geometry - Package dimensions, pad sizes, and land pattern recommendations
- Electrical specs - Absolute max ratings, operating conditions, thermal data
- Power requirements - Voltage rails, sequencing rules, decoupling capacitors
- High-speed constraints - Impedance targets, length matching, termination requirements
- And more - DRC rules, boot configuration, reference design BOM
The output is structured JSON that you can pipe into your CAD tools, symbol generators, design rule checkers, or documentation pipelines.
Installation
From source (requires Rust 1.85+)
Binary releases
Coming soon.
Quick Start
-
Get a Google AI Studio API key (free tier works)
-
Set your API key:
# or -
Extract data:
That's it. The tool handles uploading the PDF to Gemini, manages caching (PDFs are cached for 48 hours to avoid re-uploads), and returns structured JSON.
Extraction Tasks
pinout - Pin Configuration
Extracts complete pin tables for schematic symbol generation.
footprint - Package Dimensions
Extracts mechanical data for PCB footprint generation.
characteristics - Electrical Specifications
Extracts parametric data for simulation and design verification.
power - Power Supply Requirements
Extracts power sequencing and decoupling requirements.
high-speed - Routing Constraints
Extracts impedance, length matching, and termination requirements for USB, Ethernet, DDR, etc.
custom - Your Own Prompts
Use your own extraction prompt and JSON schema:
application-circuit - Typical Application Circuit
Extracts the full circuit topology from "Typical Application Circuit" diagrams as a structured netlist. Output includes typed components (ic, resistor, capacitor, diode, etc.), typed nets (power_input, power_output, ground, signal, internal), and pin-level connections. Useful as a starting point for schematic capture. Tested on TPS5430, TP4056, DRV8871.
All Tasks
| Task | Description |
|---|---|
pinout |
Pin configuration for schematic symbols |
footprint |
Package dimensions for PCB footprints |
characteristics |
Electrical and thermal specifications |
power |
Power rails, sequencing, decoupling |
high-speed |
High-speed interface routing constraints |
drc-rules |
PCB design rule constraints |
boot-config |
Boot mode and configuration pins |
layout-constraints |
Component placement rules |
reference-design |
Reference schematic BOM |
feature-matrix |
Part variant comparison |
application-circuit |
Typical application circuit as structured netlist |
custom |
User-defined extraction |
Distributor Integration
Mouser
Search parts and download datasheets directly:
# Search by keyword
# Get detailed part info
# Download datasheet
# Quick stock and pricing check
Requires: MOUSER_API_KEY (Get one here)
DigiKey
# Search parts
# Get part details
# Download datasheet
# Quick stock and pricing check
Requires: DIGIKEY_CLIENT_ID and DIGIKEY_CLIENT_SECRET (Register here)
JLCPCB / LCSC
Search the JLCPCB SMT parts library. No API key required.
# Search for parts
# Get detailed part info (includes JLCPCB assembly category, pricing, attributes)
# Quick stock and pricing check
Part details include the JLCPCB assembly category (basic, preferred, or extended) which determines feeder loading fees during assembly.
SnapEDA / SnapMagic
Search parts and retrieve exact CAD data (symbols, footprints, pin-to-pad mappings) from SnapEDA. Basic search and data retrieval require no API key. Authenticated access unlocks direct CAD file downloads and improves success rate for parts whose data isn't available via the public API.
# Search for parts (no login required)
# Get complete symbol + footprint + pin-to-pad mapping
# Get only footprint data
# Get only symbol / pinout data
# Log in to SnapEDA for authenticated downloads (session cached for 7 days)
# Download CAD files directly (requires login)
The <part> argument is flexible — it auto-detects the input format:
- Numeric ID — treated as a SnapEDA
unipart_iddirectly (e.g.,datasheet snapeda part 123456) - Part number — searches SnapEDA and uses the first match (e.g.,
ADS1115IDGST) - SnapEDA URL — extracts the part name from the URL and searches (e.g.,
"https://www.snapeda.com/parts/TP4056-42-ESOP8/toppower/view-part/")
Authentication & fallback chain: The footprint, symbol, and part subcommands first try the public Eagle XML API. If that returns empty (which happens for ~40% of parts), and you are logged in, they automatically fall back to downloading the Eagle format via the authenticated API, then to kicad_mod as a last resort. Logging in significantly improves part coverage.
Download formats: altium_native (default — returns .IntLib), eagle (.lbr), kicad (.kicad_sym), kicad_mod (.kicad_mod), kicad_modv6.
Example workflow:
# One-time login (prompts for password securely if not provided)
# Search for a part
# Get footprint data by part number (auto-falls back to authenticated download if needed)
# Download Altium library file directly
# Save extraction to file
SnapEDA data is derived from CAD models, so coordinates and dimensions are exact rather than LLM-interpreted. All coordinates include units (e.g., "-2.475mm"). The part subcommand returns a combined object with pinout, footprint, and pin_to_pad_map sections; the symbol and footprint subcommands return only their respective section.
This makes SnapEDA a useful complement to PDF extraction: use SnapEDA for precise pad geometry and pin-to-pad mappings, and PDF extraction for electrical characteristics, timing specs, and other parametric data not present in CAD models.
Stock & Pricing
All three distributors support a stock subcommand for a quick availability and pricing check without downloading a full datasheet. Returns stock level, pricing breaks, lead time, lifecycle status, and MOQ. Uses existing API data — no additional API calls beyond the standard part lookup.
When --json is used, each outputs a normalized StockInfo object suitable for scripting and automated availability checks.
SVD Register Maps
Search and download SVD (System View Description) register map files from the cmsis-svd-data collection (872 files, 25 vendors). No API key required. The index is cached locally for 24 hours.
# Search for SVD files for a chip
# Download an SVD file
# List all supported vendors
SVD files describe the complete peripheral register map for a microcontroller and are used by debuggers (OpenOCD, probe-rs), IDEs, and firmware tools to provide register-level insight. They are the input format for tools like svd2rust (Rust PAC generation) and svdtools.
Pipeline Examples
Generate KiCad symbols
|
Batch process a directory
for; do
base=
done
Compare power requirements across parts
for; do
done
Options
datasheet extract <TASK> <PDF> [OPTIONS]
Options:
--model <MODEL> Gemini model (default: gemini-3-pro-preview)
--out <FILE> Output file (default: stdout)
-f, --formatted Pretty-print JSON
--prompt <TEXT|FILE> Custom prompt (for 'custom' task)
--schema <JSON|FILE> Custom JSON schema (for 'custom' task)
--no-cache Disable PDF caching (re-upload each time)
--api-key <KEY> API key (default: $GOOGLE_API_KEY or $GEMINI_API_KEY)
Caching
PDFs are uploaded to Gemini's File API and cached locally for 48 hours. This means:
- First extraction of a new PDF: uploads the file (~1-10 seconds depending on size)
- Subsequent extractions of the same PDF: uses cached reference (instant)
Cache location: ~/.cache/datasheet-cli/ (Linux) or platform equivalent.
To force re-upload: --no-cache
Accuracy
The prompts are designed with anti-hallucination measures:
- Every extraction includes verification data (part number, revision) that you can check
- Missing data is explicitly marked as
nullor"not specified"rather than guessed - Prompts instruct the model to return errors if key sections aren't found
That said, this is an LLM - always verify critical dimensions before sending boards to fab.
Model Selection
The default model is gemini-3-pro-preview. You can override with --model:
For large datasheets (500+ pages), the newer Gemini models with expanded context windows work best.
Cost
Gemini has a generous free tier. For typical usage:
- ~1000 datasheet extractions/month on free tier
- ~$0.001-0.01 per extraction on paid tier
The exact cost depends on PDF size and model used.
Limitations
- Only works with Gemini (no OpenAI/Anthropic support currently)
- PDFs must be readable (not scanned images without OCR)
- Some older/unusual datasheet formats may not extract cleanly
- Maximum PDF size depends on Gemini's limits (~100MB)
Contributing
Contributions welcome. Areas that could use help:
- Additional extraction prompts for specific use cases
- Integration with other CAD tools (Altium, Eagle, OrCAD)
- Support for other LLM providers
- Better error handling and validation
License
GPL-3.0-only. See LICENSE for details.
See Also
- kicad-footprint-generator - Generate KiCad footprints from parameters
- KicadModTree - Python library for KiCad footprint scripts