Skip to main content

Background CLI utility that copies OTPs from Gmail to clipboard on hotkey trigger

Project description

OTPilot

Press a hotkey. Your OTP is already copied.

pip install otpilot

✈ OTPilot v2.3

Background utility that fetches OTPs from Gmail and copies them to your clipboard with a single hotkey press.

GitHubInstallQuickstartContributing


How It Works

  1. OTPilot sits in your system tray with no background polling.
  2. Press your hotkey or run otpilot fetch to scan recent Gmail messages.
  3. OTP is copied to clipboard and optionally auto-pasted.

Installation

pip install otpilot

Requirements

  • Python 3.10+
  • A Gmail account

Linux users must install clipboard support:

sudo apt install xclip  # Debian/Ubuntu

Quickstart

1. Run Setup

otpilot setup

The wizard will:

  • Open your browser for a one-time Google sign-in (read-only Gmail access)
  • Let you configure hotkey, notifications, and scan preferences
  • Save everything locally

2. Start OTPilot

otpilot start

OTPilot runs in the background with a system tray icon when supported.

3. Daily Use

  1. Receive an OTP email
  2. Press your hotkey (default: Ctrl+Shift+O)
  3. Paste

CLI Commands

Command Description
otpilot setup Run or re-run the interactive setup wizard
otpilot start Start the background service
otpilot stop Stop the background service
otpilot fetch Trigger a one-time OTP fetch from the CLI
otpilot history Show recent OTP history
otpilot history --clear Clear OTP history
otpilot logs Tail the OTPilot log file
otpilot status Show auth state, hotkey, and config
otpilot hotkey View or reconfigure the global hotkey
otpilot logout Clear stored auth token
otpilot update Check PyPI for updates and upgrade
otpilot version Print the installed version

Configuration

OTPilot stores its configuration at ~/.otpilot/config.json:

{
  "hotkey": "ctrl+shift+o",
  "notify_on_copy": true,
  "otp_max_age_minutes": 10,
  "email_fetch_count": 10,
  "otp_history_count": 10,
  "auto_paste": false,
  "auto_start_on_boot": false,
  "notification_sound": false,
  "mask_otp_in_notification": true,
  "check_updates_on_start": true
}
Field Type Default Description
hotkey string ctrl+shift+o Global hotkey combination
notify_on_copy bool true Show desktop notification when OTP is copied
otp_max_age_minutes int 10 Ignore emails older than this (minutes)
email_fetch_count int 10 Number of recent emails to scan (max 50)
otp_history_count int 10 Number of OTP history entries to keep (max 50)
auto_paste bool false Auto-paste OTP after copying
auto_start_on_boot bool false Launch OTPilot on login
notification_sound bool false Play a sound with notifications
mask_otp_in_notification bool true Mask middle digits in notification (e.g. 84••93)
check_updates_on_start bool true Check PyPI for a newer version on startup

Files Stored Locally

Path Purpose
~/.otpilot/config.json Hotkey and runtime settings
~/.otpilot/history.json OTP history entries
~/.otpilot/otpilot.log Background service log
~/.otpilot/otpilot.pid PID of the running background process
System keyring (otpilot) Preferred OAuth token storage
~/.otpilot/token.json Fallback token storage

OTP History

Show recent entries:

otpilot history

Show only 3 entries:

otpilot history --count 3

Clear history:

otpilot history --clear

Platform Support

Platform Status Notes
macOS Full support
Windows Full support
Linux Requires xclip or xsel

How OTP Extraction Works

OTPilot scans the subject line and body of your recent emails for:

  • 4–8 digit standalone numbers near context words like OTP, code, verify, one-time, passcode, authentication, 2FA
  • Only emails within otp_max_age_minutes are considered
  • Subject line matches are prioritized over body matches

Security & Privacy

  • Read-only Gmail access
  • On-demand only, no background polling
  • Local storage for tokens and configuration
  • No telemetry or analytics

Troubleshooting

Issue Solution
"Not authenticated" error Run otpilot setup to re-authenticate
No OTP found Check otp_max_age_minutes — the email might be too old
Clipboard not working (Linux) Install xclip: sudo apt install xclip
Hotkey not working Run otpilot hotkey to reconfigure
Tray icon not visible Check your system tray / menu bar settings
Stop doesn’t work Run otpilot stop again or delete ~/.otpilot/otpilot.pid
Log file empty Start OTPilot and run otpilot logs after a fetch

Contributing

Contributions are welcome. See docs/CONTRIBUTING.md for dev setup and code standards.


License

MIT License.

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

otpilot-2.3.1.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

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

otpilot-2.3.1-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file otpilot-2.3.1.tar.gz.

File metadata

  • Download URL: otpilot-2.3.1.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for otpilot-2.3.1.tar.gz
Algorithm Hash digest
SHA256 882125554b2f64242ff5e32057460307ba0714c634925169cab893e30ab98f57
MD5 53b34031f354bae2bf5aac1b20cf058b
BLAKE2b-256 216f0e0c2b9a56fb6ee1112f22b9b3dec8377aeead8dc95464d58c5488bf7a8f

See more details on using hashes here.

File details

Details for the file otpilot-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: otpilot-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for otpilot-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13779f1df734f052f77b37f7ef096c9fc6139abb6fa88d15d8914bc25d046fa2
MD5 6b9483c960289b777af463453a478e6e
BLAKE2b-256 9718a84f093262c851d064ec47639a8724a49e35b47f5cd728b16eae82ab744c

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