blog-posting-pipeline
Blog Posting Pipeline
Small businesses want a steady stream of articles; nobody has time to write them. This program does the whole job in one run: it researches the topic, plans the article, writes it, makes a picture, and posts it on the client's site. It cannot invent sources or links, only use pages it genuinely found. It runs unattended for the client sites configured in its registry, and it prices every run against verified rates, so a post costs a known $0.37 to $0.40; the linked demo is a fabricated walkthrough.
Built and operated by our founder, Salman Adnan; it runs unattended on a VPS and serves several agency clients. Its source is private since the pipeline is the agency's live product, not just data that can be scrubbed. The linked demo is a fabricated walkthrough of the same 7-step architecture, not the real system.
Overview
A production pipeline that researches, writes, illustrates, and publishes SEO blog posts for agency client sites. One CLI run produces one complete, optimized post with citations and internal links.
Two packages live here: simple_blog (the live system) and blog_generator (the retired first generation). Every LLM step in the live pipeline uses one fixed, client-agnostic system prompt; all client-specific data travels in the user message.
Key features
- A standardized 7-step pipeline: brief, keyword strategy, section plan, a cited article with real internal links, a hero image, and a push to the client's publish endpoint.
- Internal links cannot be invented: the writer gets links only through a Pinecone search over the client's own crawled site, and validate_links() strips any URL the tool did not return.
- Citations cannot be hallucinated: external source URLs come only from Perplexity's API response.
- Compliance is enforced per client via a non-negotiable block injected at the top of every prompt.
- Every step is instrumented with real metrics: cache hit rates, token counts, and API call measurements are logged for analysis.
Results
- Embeddings via gemini-embedding-001 at 3072 dimensions; about 70% of the step-4 writer input served from cache.
- Cost is billed, not guessed. pricing.py charges every token, cache write, cache-storage hour, Perplexity request fee, and Pinecone read against rates verified from the providers' own pricing pages, and each run writes its exact cost to a cost.json.
- A post typically costs $0.37 to $0.40, taken from a real run's cost.json. Token costs are exact from measured usage; the total is quoted as a band because two components are range-priced (the preview image model and Pinecone read units) and token usage varies per post, so any single run's cost.json is the exact figure.
- That number is an honest correction, not a sales figure: an earlier claim of roughly $0.16 per post was wrong, and billing the full cache lifecycle (writes and per-hour storage, not just cached reads) put the real cost at $0.37 to $0.40. The dominant costs, the pro writer, the cited body research, and the image, are inherent and were never cacheable away.
- The COMPANIES registry holds seven site profiles: five external client sites, the agency's own product site (davonex.com, shown above), and a local test profile. Onboarding a site is a data change, not a code change, because every step uses one fixed, client-agnostic system prompt.
- The system runs unattended on a VPS and has served multiple agency clients with consistent output quality.
Tech stack
A challenge worth noting
Generation and context caching for the Gemini 3.x previews are served only from the global endpoint while embeddings are served from a region, and re-pointing the shared location mid-run breaks in-flight models. The fix is a separate region-pinned client for embeddings. The design lesson: fixed prompt with variable data beats fixed data with a variable prompt, which turned client onboarding from a code change into a data change.