When a 2,000-word article shows up on a low-energy day, you don’t have minutes to spare. This automation grabs the current tab, sends it to OpenAI for a tight summary, and appends the result to your Obsidian or Notion inbox so you can skim it later.

Quick Path ⚡️

  1. Install the script runner: Raycast (macOS) or AutoHotkey (Windows) for global hotkeys.
  2. Drop in the summary script below, add your OPENAI_API_KEY, and point it at your notes file or Notion webhook.
  3. Press ⌥⌘S / Alt+Ctrl+S on any page—summary arrives in 5 bullet points under Today’s notes.

What You’ll Set Up

  • An OpenAI API key (gpt-4o-mini keeps costs low).
  • Raycast Script Command (macOS) or AutoHotkey script (Windows).
  • pip install beautifulsoup4 (macOS script uses BeautifulSoup to strip HTML).
  • Obsidian vault or Notion inbox page to receive the summary (Notion users should create an incoming webhook).
  • Optional: Sticky Keys / Slow Keys if pressing multiple modifiers is difficult.

Copy & Paste Zone

# macOS — save as ~/.config/raycast/scripts/ai-summary.sh
#!/usr/bin/env bash
set -euo pipefail
: "${OPENAI_API_KEY:?Set OPENAI_API_KEY in Raycast Environment Variables}"

URL=$(osascript -e 'tell application "Safari" to return URL of front document' 2>/dev/null || \
      osascript -e 'tell application "Google Chrome" to return URL of active tab of front window')
CONTENT=$(python3 - <<'PY'
import sys, textwrap, urllib.request
from bs4 import BeautifulSoup
url = sys.argv[1]
html = urllib.request.urlopen(url, timeout=10).read()
soup = BeautifulSoup(html, "html.parser")
print(textwrap.shorten(soup.get_text(separator=" "), width=6000))
PY
 "$URL")

SUMMARY=$(curl -s https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<JSON | python3 -c 'import json,sys;print(json.load(sys.stdin)["choices"][0]["message"]["content"])'
{
  "model": "gpt-4o-mini",
  "messages": [
    {"role": "system", "content": "You create executive summaries in plain language for someone managing MS-related brain fog. Respond with: 1) 3 bullet summary, 2) Why it matters in one sentence, 3) One question to revisit later."},
    {"role": "user", "content": "URL: $URL\n\nText:\n$CONTENT"}
  ]
}
JSON
)

echo "### $(date '+%Y-%m-%d %H:%M')${URL}"$'\n'"$SUMMARY"$'\n' >> "$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/MS Vault/Inbox.md"
osascript -e 'display notification "Summary added to Inbox.md" with title "AI Summary Drop Zone"'
; Windows — save as ai-summary.ahk and run with AutoHotkey v2
#Requires AutoHotkey v2.0
; Hotkey: Alt+Ctrl+S
!^s::{
    url := WinGetActiveTitle()
    clipSaved := ClipboardAll()
    Send "^l"
    Sleep 100
    Send "^c"
    ClipWait
    url := Clipboard
    Send "{Esc}"

    RunWait Format('powershell -ExecutionPolicy Bypass -File "{1}" -Url "{2}"', A_ScriptDir "\ai-summary.ps1", url)
    Clipboard := clipSaved
}
# ai-summary.ps1 — called by the AutoHotkey script above
Param([string]$Url)
$Env:OPENAI_API_KEY || throw "Set OPENAI_API_KEY as a user environment variable."
$response = Invoke-WebRequest -Uri $Url -UseBasicParsing -TimeoutSec 10
$plain = [regex]::Replace($response.Content, '<[^>]+>', ' ')
$body = @{
  model = "gpt-4o-mini"
  messages = @(
    @{ role = "system"; content = "You create plain-language summaries for someone managing chronic illness. Answer with 3 bullets, a why-it-matters line, and 1 follow-up question." }
    @{ role = "user"; content = "URL: $Url`n`nText:`n$($plain.Substring(0, [Math]::Min($plain.Length, 6000)))" }
  )
} | ConvertTo-Json -Depth 4
$summary = Invoke-RestMethod -Uri "https://api.openai.com/v1/chat/completions" -Headers @{Authorization = "Bearer $env:OPENAI_API_KEY"} -Method Post -ContentType "application/json" -Body $body
$output = "### $(Get-Date -Format 'yyyy-MM-dd HH:mm')$Url`n$($summary.choices[0].message.content)`n"
$output | Out-File "$env:USERPROFILE\Documents\AI-Summaries\Inbox.md" -Encoding UTF8 -Append
New-BurntToastNotification -Text "AI Summary Drop Zone", "Summary saved to Documents\AI-Summaries\Inbox.md"

Variations & Troubleshooting

Show variations & fixes

  • Send to Notion instead of Markdown: Replace the final Out-File / echo line with a curl or PowerShell Invoke-RestMethod call to your Notion webhook URL.
  • Windows toast missing: Install BurntToast (Install-Module -Name BurntToast -Scope CurrentUser) or comment out the New-BurntToastNotification line.
  • Browser permission errors on macOS: Grant Safari/Chrome Automation rights to Raycast in System Settings → Privacy & Security → Automation.
  • API quota or latency: Downgrade to gpt-4o-mini (already set) or switch to gpt-4o-mini-translate for faster summarization; cache the raw article text locally to avoid repeated downloads.
  • Accessibility boost: Map the hotkey to a single key using Sticky Keys, or trigger the script via voice (e.g., Voice Control custom command → “Summarize this page” → press shortcut).

Next Steps