DEV Community

Henry Knight
Henry Knight

Posted on

5 Python Scripts That Cut My SaaS Bill to $7/month (Using Claude API)

Most developers I know are paying $100–$200/month for SaaS tools that could be replaced with 50 lines of Python. Not as a side project. Not "someday." Right now, this week.

I spent a weekend swapping out five subscriptions for scripts. The scripts run locally, cost almost nothing (Claude API calls average pennies per run), and do the job better than the SaaS tools because I built them exactly for my workflow.

Here's what I replaced and how.


The SaaS Subscription Trap

Let me show you what a "standard" dev tools stack looks like:

  • Zapier – $49–$99/month for automation
  • Make (formerly Integromat) – $29–$99/month
  • n8n Cloud – $20–$50/month
  • Notion AI – $10/month add-on
  • Some research SaaS tool – $49/month
  • OCR / document processing SaaS – $50–$200/month

That's $200–$500/month before you hit any real scale. And for what? Drag-and-drop interfaces and rate limits.

The dirty secret: every single one of these tools is just calling an API, parsing some JSON, and doing something with it. Which is exactly what Python does.

Add the Claude API ($5–$15/month in real usage) and you've got a stack that replaces all of them.


Script 1: AI Email Classifier (Replaces $49/month Tool)

This replaces a Zapier workflow that was routing emails to folders. The script reads your inbox, classifies each email with Claude, and moves it to the right label.

import anthropic
import imaplib
import email
from email.header import decode_header

client = anthropic.Anthropic()

def classify_email(subject: str, body_preview: str) -> str:
    message = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=50,
        messages=[{
            "role": "user",
            "content": f"""Classify this email into exactly one category:
URGENT, NEWSLETTER, INVOICE, SOCIAL, OTHER

Subject: {subject}
Body preview: {body_preview[:300]}

Reply with only the category name."""
        }]
    )
    return message.content[0].text.strip()

def process_inbox(email_addr: str, password: str, imap_server: str):
    mail = imaplib.IMAP4_SSL(imap_server)
    mail.login(email_addr, password)
    mail.select("inbox")

    _, message_ids = mail.search(None, "UNSEEN")

    for msg_id in message_ids[0].split()[:20]:
        _, msg_data = mail.fetch(msg_id, "(RFC822)")
        msg = email.message_from_bytes(msg_data[0][1])

        subject = decode_header(msg["Subject"])[0][0]
        if isinstance(subject, bytes):
            subject = subject.decode()

        body = ""
        if msg.is_multipart():
            for part in msg.walk():
                if part.get_content_type() == "text/plain":
                    body = part.get_payload(decode=True).decode()
                    break
        else:
            body = msg.get_payload(decode=True).decode()

        category = classify_email(subject, body)
        print(f"[{category}] {subject}")

    mail.logout()
Enter fullscreen mode Exit fullscreen mode

Run it as a cron job every 15 minutes. Cost per run: ~$0.002 in API calls. Monthly cost: under $1.


Script 2: Web Scraper + Summarizer (Replaces $49/month Research Service)

This replaces a research SaaS tool that was sending daily digests. The script scrapes a list of URLs, extracts the main content, and generates a summary with Claude.

import anthropic
import requests
from bs4 import BeautifulSoup

client = anthropic.Anthropic()

def scrape_and_clean(url: str) -> str:
    headers = {"User-Agent": "Mozilla/5.0 (compatible; research-bot/1.0)"}
    response = requests.get(url, headers=headers, timeout=10)
    soup = BeautifulSoup(response.content, "html.parser")

    for tag in soup(["script", "style", "nav", "footer", "aside"]):
        tag.decompose()

    main = soup.find("main") or soup.find("article") or soup.body
    return main.get_text(separator=" ", strip=True)[:3000]

def summarize_research(urls: list[str], topic: str) -> str:
    all_content = []
    for url in urls:
        try:
            content = scrape_and_clean(url)
            all_content.append(f"Source: {url}\n{content}")
        except Exception as e:
            print(f"Failed {url}: {e}")

    combined = "\n\n---\n\n".join(all_content)

    message = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=800,
        messages=[{
            "role": "user",
            "content": f"""You're a research analyst. Summarize the key findings from these sources about: {topic}

Sources:
{combined}

Format: 5 bullet points with the most actionable insights. Be specific."""
        }]
    )
    return message.content[0].text
Enter fullscreen mode Exit fullscreen mode

Script 3: Form Data Extractor with Claude Vision (Replaces Expensive OCR SaaS)

OCR SaaS tools charge $50–$200/month to extract data from PDFs and images. Claude's vision API does this in 10 lines.

import anthropic
import base64
import json
from pathlib import Path

client = anthropic.Anthropic()

def extract_form_data(image_path: str) -> dict:
    image_data = base64.standard_b64encode(
        Path(image_path).read_bytes()
    ).decode("utf-8")

    suffix = Path(image_path).suffix.lower()
    media_type = {
        ".jpg": "image/jpeg", ".jpeg": "image/jpeg",
        ".png": "image/png"
    }.get(suffix, "image/jpeg")

    message = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=1024,
        messages=[{
            "role": "user",
            "content": [
                {
                    "type": "image",
                    "source": {
                        "type": "base64",
                        "media_type": media_type,
                        "data": image_data,
                    },
                },
                {
                    "type": "text",
                    "text": "Extract all form fields from this document. Return as JSON with field names as keys and extracted values as values. Include: name, date, address, phone, email, amounts, checkboxes (true/false). Return only valid JSON."
                }
            ],
        }]
    )

    return json.loads(message.content[0].text)

# Usage
data = extract_form_data("invoice.png")
print(data)
# {"vendor": "Acme Corp", "amount": "$1,240.00", "date": "2026-06-01"}
Enter fullscreen mode Exit fullscreen mode

Script 4: Content Calendar Generator (Replaces Notion AI)

import anthropic
from datetime import datetime

client = anthropic.Anthropic()

def generate_content_calendar(
    niche: str,
    audience: str,
    weeks: int = 4,
    posts_per_week: int = 3
) -> str:
    start_date = datetime.now()

    message = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=2000,
        messages=[{
            "role": "user",
            "content": f"""Create a {weeks}-week content calendar for:
Niche: {niche}
Audience: {audience}
Frequency: {posts_per_week} posts/week
Start date: {start_date.strftime('%Y-%m-%d')}

For each post include:
- Date
- Platform (Twitter/LinkedIn/Blog)
- Hook (first line, attention-grabbing)
- Core topic
- CTA

Format as a markdown table. Make hooks specific and scroll-stopping."""
        }]
    )
    return message.content[0].text

calendar = generate_content_calendar(
    niche="Python automation for indie developers",
    audience="Solo developers and freelancers",
    weeks=4
)
print(calendar)
Enter fullscreen mode Exit fullscreen mode

Script 5: Automated Weekly Report Writer

import anthropic
import sqlite3
from datetime import datetime, timedelta

client = anthropic.Anthropic()

def generate_weekly_report(db_path: str, report_type: str = "business") -> str:
    conn = sqlite3.connect(db_path)
    cursor = conn.cursor()

    week_ago = (datetime.now() - timedelta(days=7)).isoformat()

    cursor.execute("""
        SELECT date, metric_name, value 
        FROM metrics 
        WHERE date >= ? 
        ORDER BY date DESC
    """, (week_ago,))

    rows = cursor.fetchall()
    conn.close()

    data_text = "\n".join([f"{r[0]} | {r[1]}: {r[2]}" for r in rows])

    message = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=1500,
        messages=[{
            "role": "user",
            "content": f"""Write a professional weekly {report_type} report based on this data:

{data_text}

Include:
1. Executive summary (3 sentences)
2. Key wins this week
3. Areas needing attention
4. Recommended actions for next week
5. Trend analysis

Be specific about numbers. Flag anything anomalous."""
        }]
    )
    return message.content[0].text

report = generate_weekly_report("my_business.db")
print(report)
Enter fullscreen mode Exit fullscreen mode

The Math

Five SaaS tools at an average $50/month = $250/month = $3,000/year.

Five Python scripts + Claude API at real usage = $5–$15/month.

That's a $2,800+ annual saving that compounds every year you keep it running.

The scripts above are starting points — you'll customize them. But every one is functional and runnable today.


I packaged all 5 of these scripts plus 5 more into a ready-to-run starter kit. Each script is documented and runnable in under 5 minutes. Grab it at https://payhip.com/b/GuGDX — $7, instant download.

Top comments (0)