Elena' s AI Blog

I used Claude to generate Pinterest pins. Here is the actual API cost.

28 May 2026 (updated: 24 Aug 2026) / 36 minutes to read

Elena Daehnhardt

Generated by ChatGPT / DALL·E. Prompt: Create a clean square title illustration for a blog post about the tiny cost of generating Pinterest-style pins with an AI API. Show a laptop with an abstract blog article on the left, an AI/Python automation flow in the centre, and generated vertical pin-style cards on the right. Use a cool blue colour palette for the overall scene. Make the “<1¢” cost badge more prominent and clearly visible in pink so it stands out strongly. Keep the illustration modern, editorial, friendly, and suitable for a technical blog header.


TL;DR:
  • - Generating one Pinterest pin with claude-sonnet-4-6 uses approximately 1,170 input tokens and 235 output tokens.
  • - At $3/$15 per million tokens, the total cost per pin is around $0.007 — less than one cent.
  • - The script caps post content at 4,000 characters, so only the opening section of a long post reaches Claude.
  • - 1,000 pins would cost approximately $7 in API calls at current Sonnet 4.6 pricing.
  • - For long posts, the best approach to capture full scope without exploding token count is algorithmic: extract the first 2,000 characters (introduction) and last 2,000 characters (conclusion), then join them in Python.
  • - Using Anthropic's Message Batches API cuts costs by 50% — 1,000 pins drops from $7.04 to $3.52.

Automating Pinterest Pin Generation with the Claude API

A Pinterest pin generator is a script that reads a blog post, calls a large language model to produce SEO-optimised pin metadata, and uploads the result to Pinterest — automating a publishing chore rather than the writing itself.

I have been slowly automating the repetitive parts of running this blog. Not the writing ideas — that stays human. But the publishing chores: resizing images, preparing metadata, checking links. The latest experiment was a Pinterest pin generator.

The script reads a Jekyll post from _posts/, sends a cleaned-up version to Claude, and receives back a pin title, description, hashtags, and a short image excerpt. The script then renders a 1000×1500 JPEG and uploads it to Pinterest via the v5 API.

Before I ran this over my whole archive, I had one very practical question: how much will this actually cost?

There is a specific kind of programmer’s dread that kicks in when you are about to loop a script over your entire post archive — not “will it work?” but “will it charge me forty dollars while I’m not watching?” So I decided to calculate it properly: not a rough guess, but an exact breakdown of what the script sends, how many tokens that produces, and what the API charges for it.

This post walks through that calculation. If you are building something similar, the methodology is reusable for any prompt-based workflow.


Claude API Prompt Structure for Pinterest Pin Generation

The script calls claude-sonnet-4-6 with a single user message. There is no system prompt. The message is built from four parts:

  1. A fixed instruction block describing the task
  2. The post’s existing title (from YAML front matter)
  3. The post’s existing tags (from YAML front matter)
  4. The post body, stripped of markdown syntax and truncated to 4,000 characters

After Claude responds, the script parses the JSON and enforces character limits: title to 100 characters, description to 500, hashtags to 5, excerpt to 200.

Here is the exact prompt template the script uses:

prompt = f"""You are an expert Pinterest SEO strategist.

Analyse the blog post below and return a JSON object with these exact keys:
  "title"       – Pinterest pin title, max 100 characters, compelling and keyword-rich
  "description" – Pin description, max 500 characters, natural tone, rich with keywords
  "hashtags"    – Array of up to 5 relevant hashtags WITHOUT the # symbol
  "excerpt"     – 1–2 short punchy sentences (max 200 chars) to overlay on the pin image

Existing post title : {existing_title}
Existing tags       : {', '.join(existing_tags)}

POST CONTENT:
{content_plain}

Return ONLY the JSON object, no markdown, no extra text."""

Prompt Anatomy — Where the Characters Come From

🔒 Subscribe to keep reading.

Token Estimation for claude-sonnet-4-6 API Calls

🔒 Subscribe to keep reading.

Claude API Cost Calculation Per Pinterest Pin

🔒 Subscribe to keep reading.

Pinterest Pin Generation Cost at Scale (1 to 10,000 Pins)

🔒 Subscribe to keep reading.

The 4,000-Character Content Truncation Limit

🔒 Subscribe to keep reading.

Anthropic Message Batches API: Asynchronous Batch Pattern

🔒 Subscribe to keep reading.

Pinterest Pin Generation Cost Summary

🔒 Subscribe to keep reading.

References

🔒 Subscribe to keep reading.

You've hit a Deep Dive tutorial.

I spend dozens of hours researching, coding, and breaking things to write these guides. This content is free, but reserved for my subscriber community. Drop your email below to unlock this guide (and all past/future deep dives):

Already a subscriber? Use the magic link from your last newsletter, or reset your password.

New subscribers get an inbox mail: Set a password to unlock articles. The form does not log you in — use the same email afterwards.

desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.

Citation
Elena Daehnhardt. (2026) 'I used Claude to generate Pinterest pins. Here is the actual API cost.', daehnhardt.com, 28 May 2026. Available at: https://daehnhardt.com/blog/2026/05/28/pinterest-pin-generator-api-cost/
All Posts