Anthropic's fastest frontier model rewrites existing AU seo_content into a 13-section Billoff article. Precise instruction-following, clean structured prose, near-frontier intelligence.
V4 rewrites the existing seo_content from the AU pipeline JSON using Anthropic's Claude Haiku 4.5 (claude-haiku-4-5-20251001). No web search — same logic as step_04 in the Postclic pipeline, adapted for Billoff, English, Australia, with 4 article plan choices (A–D). Distinguishes itself from V2/V3 by exceptional instruction-following and natural prose quality.
seo_content → Rewrite prompt (Plan A/B/C/D) → Billoff-branded English article via Claude.| Attribute | Value |
|---|---|
| Model | claude-haiku-4-5-20251001 (Anthropic) |
| API endpoint | api.anthropic.com/v1/messages |
| API version header | anthropic-version: 2023-06-01 |
| Web search | None |
| Input source | Existing seo_content from AU JSON (up to 4,000 chars) |
| Article plans | Auto / Plan A / Plan B / Plan C / Plan D |
| Streaming | Yes — Anthropic SSE (multi-event format) |
| Max output tokens | 16 000 (increased to prevent truncation) |
| Context window | 200 000 tokens |
| Avg article length | 1 800–2 200 words |
| Avg quality score | 8–9/10 |
| Cost per article | ≈ €0.003–0.005 |
| Avg generation time | 20–35 seconds |
| Cost × 1 000 articles | ≈ €3–5 |
| Cost × 50 000 articles | ≈ €150–250 |
┌─────────────────────────────────────────────────────────┐ │ SERVICE DATA (name, category, website, keywords, etc.) │ └────────────────────────┬────────────────────────────────┘ │ ┌──────────────▼──────────────────┐ │ REWRITE INPUT BLOCK │ │ • Existing seo_content (~4K ch) │ │ • Service metadata │ │ • Cancellation methods │ │ • Keywords │ └──────────────┬───────────────────┘ │ ┌──────────────▼───────────────────┐ │ REWRITE PHASE │ │ Rewrite Prompt (Plan A/B/C/D) │ claude-haiku-4-5-20251001 │ + system message (brand) │ max_tokens=16000 │ + messages [{role:user, ...}] │ stream=true └──────────────┬───────────────────┘ │ FINAL ARTICLE (HTML, ~1 900 words, 14 H2, 2+ tables)
Billoff/functions/api/claude.js — Cloudflare Pages Function proxy (injects ANTHROPIC_API_KEY server-side)Billoff/web/assets/openai.js → streamClaude() + generateV4() — Browser-side generatorBilloff/scripts/04_generate_v4.py — Python batch generator (to create)The Anthropic API key is never exposed to the browser. All calls go through /api/claude:
// functions/api/claude.js — key logic export async function onRequestPost(context) { const apiKey = context.env.ANTHROPIC_API_KEY; // Cloudflare secret const body = await request.text(); const upstream = await fetch('https://api.anthropic.com/v1/messages', { method: 'POST', headers: { 'x-api-key': apiKey, 'anthropic-version': '2023-06-01', 'content-type': 'application/json', }, body, }); return new Response(upstream.body, { headers: { 'Content-Type': upstream.headers.get('Content-Type') } }); }
// openai.js — streamClaude() await fetch('/api/claude', { method: 'POST', body: JSON.stringify({ model: 'claude-haiku-4-5-20251001', max_tokens: 8000, stream: true, system: systemMsg, messages: [{ role: 'user', content: prompt }], }) });
Claude SSE uses a multi-event protocol. Unlike OpenAI (single data: lines), Anthropic sends pairs of event: + data: lines:
// Stream events (in order) event: message_start data: {"type":"message_start","message":{"usage":{"input_tokens":2847,"output_tokens":1}}} event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"<h2>1"}} // ... more content_block_delta events ... event: message_delta data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":1823}} event: message_stop data: {"type":"message_stop"}
The parser in streamClaude() accumulates input_tokens from message_start and output_tokens from message_delta, normalising to {prompt_tokens, completion_tokens} for cost calculation.
V4 uses the Rewrite Prompt Template (shared with V2/V3) — an English/AU/Billoff adaptation of the Postclic PROMPT_SEO_CONTENT.txt, plus a dedicated system message:
"You are a senior SEO content writer for Billoff (billoff.com). " "CRITICAL: Always use the brand name 'Billoff'. NEVER write 'Postclic'. " "Target length: 1,600–2,200 words of pure HTML. " "Start directly with <h2>. No markdown."
system field is processed separately from the user message, giving it higher prioritySections 2, 4–14 are identical to V1/V2/V3. Section 3 uses "Cancellation Considerations" (no competitor table — no live data).
Pricing source: docs.anthropic.com/en/docs/about-claude/pricing (verified Feb 2026)
| Component | Tokens | Rate | Cost (USD) | Cost (EUR) |
|---|---|---|---|---|
| Input (prompt + system) | ~2 900 | $1.00 / 1M | $0.00290 | €0.00267 |
| Output (article) | ~1 800 | $5.00 / 1M | $0.00900 | €0.00828 |
| TOTAL / article | ~4 700 | — | ~$0.0119 | ~€0.0109 |
| × 20 articles | $0.238 | €0.219 | ||
| × 1 000 articles | $11.90 | €10.95 | ||
| × 50 000 articles | $595 | €548 |
Prompt caching (available on Claude): if you repeatedly send the same system message + service template, Anthropic charges $0.10/1M for cached reads (vs $1.00/1M). At scale with consistent prompts, this can reduce input costs by up to 90%.
| Scenario | Without cache | With cache (90% reads) |
|---|---|---|
| 50 000 articles | $595 / €548 | ~$300 / €276 |
# From Billoff/ directory python scripts/04_generate_v4.py # Compare all 4 methods on 1 service python scripts/test_compare_3methods.py
import anthropic client = anthropic.Anthropic(api_key="sk-ant-...") message = client.messages.create( model="claude-haiku-4-5-20251001", max_tokens=8000, system="You are a senior SEO writer for Billoff...", messages=[{ "role": "user", "content": prompt }], ) html = message.content[0].text usage = message.usage # input_tokens, output_tokens
ANTHROPIC_API_KEY=sk-ant-api03-...
# Cloudflare: set as ANTHROPIC_API_KEY secret in Pages project settings
| ✅ Pros | ❌ Cons |
|---|---|
| Best instruction-following among V2/V3/V4 | 2–3× more expensive than V3 |
| Natural, human-like prose quality | No real-time data (pricing, competitors) |
| Consistent HTML structure (14 H2 guaranteed) | Slower than V3 Gemini Flash |
| 200K token context — handles very long inputs | Anthropic-specific SSE format (proxy required) |
| Word count targets respected within ±10% | Training cutoff limits knowledge recency |
| Prompt caching can cut costs by 90% at scale | Max 64K output tokens (generous, but fixed) |
| Fully parallelisable (100+ workers) | Brand may need explicit system enforcement |
| Highest Anthropic safety/reliability score | — |
| Priority | Best method |
|---|---|
| Maximum quality + fresh data | V1 (web research) |
| Best prose quality, no search | V4 Claude ← here |
| Best cost/quality balance | V2 or V4 |
| Maximum throughput / lowest cost | V3 Gemini Flash |
| Method | Model | Web search | Cost/article | Speed | Quality |
|---|---|---|---|---|---|
| V1 | gpt-4.1 + gpt-5-mini | ✅ 4 passes | ~€0.10 | ~120s | 9–10/10 |
| V2 | gpt-5-mini | ❌ | ~€0.011 | ~90s | 9/10 |
| V3 | gemini-2.5-flash | ❌ | ~€0.003 | ~20s | 7–8/10 |
| V4 | claude-haiku-4-5 | ❌ | ~€0.005 | ~25s | 8–9/10 |
| After all 4 methods: Gemini 3.1 Pro Preview analyses all articles and produces a comparative table + recommendation (≈€0.04/analysis). | |||||