Content Generation
Generate podcast content using AI (Anthropic Claude) with RAG-enhanced prompts from the Pinecone knowledge base.
Generate PRF
Generate a PRF (Podcast Repurposing Framework) document from a transcript.
curl -X POST https://production.youvebeenheard.com/api/ai/prf \
-H "Content-Type: application/json" \
-H "Cookie: auth_token=<token>" \
-d '{
"transcript": "Full episode transcript...",
"systemPrompt": "Generate a PRF...",
"useRAG": true
}'
Request
Full episode transcript (max 100,000 characters)
System prompt with generation instructions
Enable RAG context from Pinecone knowledge base (brand guidelines, writing style)
Custom RAG query (defaults to first 500 chars of transcript)
Response
{
"content" : "# Podcast Repurposing Framework \n\n ## Core Message \n Chris Pacifico explains..."
}
Generated PRF document (Markdown format)
RAG Context
When useRAG: true, the system:
Generates embedding for ragQuery (or transcript excerpt)
Queries Pinecone for relevant context from:
brand-manual - YBH brand guidelines
anti-ai-writing-guide - Writing style rules
brand-narrative - Brand voice examples
Appends context to system prompt
Example RAG context appended:
═══════════════════════════════════════════════════════════════════
KNOWLEDGE BASE CONTEXT (Use for reference)
═══════════════════════════════════════════════════════════════════
[Brand Manual - Voice]
We don't sell. We unsell. Anti-spin, Anti-transactional, Pro-IT leader.
---
[Anti Ai Writing Guide - Avoid]
Don't use phrases like "In today's rapidly changing world" or "Let's dive in".
Model Configuration
Uses Claude Sonnet 4 (claude-sonnet-4-20250514):
Max tokens : 8,192
Temperature : Not specified (defaults to 1.0)
System prompt : Enhanced with RAG context
Generate Viral Hooks
Generate viral social media hooks from PRF.
curl -X POST https://production.youvebeenheard.com/api/ai/hooks \
-H "Content-Type: application/json" \
-d '{
"prf": "PRF document...",
"systemPrompt": "Generate viral hooks...",
"useRAG": true
}'
Request
PRF document (Markdown or text)
System prompt with hook generation instructions
Enable brand voice context from Pinecone
Response
{
"content" : "<h2>Hook 1: The Hidden Cost</h2> \n <p>Most IT leaders...</p>"
}
Generated viral hooks (HTML format with TipTap-compatible structure)
Fact Verification : Best practice is to include the original transcript in the PRF input to enable fact-checking:const prfInput = `SOURCE TRANSCRIPT (for fact verification): \n ${ transcript } \n\n ═══...═══ \n PRF ANALYSIS: \n ${ prf } `
Generate Infographic Spec
Generate infographic design specifications with layout, colors, and content structure.
curl -X POST https://production.youvebeenheard.com/api/ai/infographic \
-H "Content-Type: application/json" \
-d '{
"selectedText": "Text to visualize...",
"episodeContext": "Episode 385: Chris Pacifico...",
"history": ["Doom Loop", "Quadrant Matrix"],
"designType": "infographic",
"systemPrompt": "Design an infographic..."
}'
Request
Text excerpt to visualize
Episode metadata and context (episode number, guest, transcript excerpt)
Previously used infographic types (for variety)
designType
string
default: "infographic"
Design type: infographic, quote, or thumbnail
System prompt with design instructions
Enable design database context from Pinecone
Response
{
"spec" : {
"layout" : "Pyramid (Bottom-Up)" ,
"template" : "Strategic Framework" ,
"title" : "The Three Pillars of IT Leadership" ,
"colorSystem" : "Corporate Professional" ,
"iconStyle" : "isometric" ,
"aspectRatio" : "16:9" ,
"contentBreakdown" : {
"mainMessage" : "IT leaders need three core skills" ,
"sections" : [ "Technical Expertise" , "Business Acumen" , "People Leadership" ],
"dataPoints" : [ "70% of CIOs" , "3-5 years average tenure" ]
},
"prompt" : "Create a professional isometric infographic..."
}
}
Infographic design specification Layout structure (e.g., “Pyramid”, “Quadrant Matrix”, “Timeline”)
Content template type (e.g., “Strategic Framework”, “Doom Loop”)
Infographic title (under 10 words)
Color palette (e.g., “Corporate Professional”, “High Contrast”)
Icon style: isometric or flat2d
Aspect ratio: 16:9, 1:1, 9:16, etc.
Content structure and data points
Complete Kie.ai generation prompt
Design Database Context
When useRAG: true, queries Pinecone for:
Layout structures (28 types): Circular, Linear, Comparison, Grid, etc.
Content templates (10 types): Doom Loop, Strategic Framework, Journey Map, etc.
Visual style systems : Icon styles, color palettes, typography rules
Skips RAG for designType: "quote" (doesn’t need layout templates).
Default Specs by Design Type
Infographic
Quote Card
Thumbnail
{
"layout" : "Card Grid" ,
"template" : "Strategic Framework" ,
"title" : "Key Insight" ,
"colorSystem" : "Corporate Professional" ,
"iconStyle" : "isometric" ,
"aspectRatio" : "16:9" ,
"prompt" : "<selectedText>"
}
{
"layout" : "hero_quote" ,
"template" : "Quote Card" ,
"title" : "Quote Card" ,
"colorSystem" : "dark_cinematic" ,
"iconStyle" : "flat2d" ,
"aspectRatio" : "1:1" ,
"prompt" : "<selectedText>"
}
{
"layout" : "thumbnail" ,
"template" : "YouTube Thumbnail" ,
"title" : "Thumbnail" ,
"colorSystem" : "dark_cinematic" ,
"iconStyle" : "flat2d" ,
"aspectRatio" : "16:9" ,
"prompt" : "<selectedText>"
}
Error Responses
All content generation endpoints return consistent error responses:
Status Error Description 400Transcript is required Missing required input 400PRF is required Missing required PRF input 400Selected text is required Missing infographic input 500Anthropic API key not configured Missing API key 500Anthropic API error Upstream API error 500Failed to generate [content] Generation error
Rate Limiting & Costs
API Costs : Content generation uses the Anthropic Claude API, which incurs costs per request:
PRF generation : ~$0.10-0.30 per episode (8K tokens)
Hooks generation : ~$0.05-0.15 per set (4K tokens)
Infographic specs : ~$0.03-0.08 per spec (2K tokens)
Monitor usage via Anthropic dashboard.
No Built-in Rate Limiting : Content generation endpoints do not enforce rate limits. Implement client-side rate limiting or request throttling as needed.
Best Practices
1. Include Source Transcript
For fact accuracy, always include the original transcript:
// PRF with transcript for context
const prfResponse = await fetch ( '/api/ai/prf' , {
body: JSON . stringify ({
transcript: fullTranscript ,
systemPrompt: prfPrompt
})
})
// Hooks with transcript for fact-checking
const hooksResponse = await fetch ( '/api/ai/hooks' , {
body: JSON . stringify ({
prf: `SOURCE TRANSCRIPT: \n ${ fullTranscript } \n\n ═══...═══ \n PRF: \n ${ prfContent } ` ,
systemPrompt: hooksPrompt
})
})
2. Use RAG for Brand Consistency
Keep useRAG: true (default) to inject brand guidelines:
{
"useRAG" : true , // Fetches brand voice, writing rules, design patterns
"ragQuery" : "viral hooks for IT leaders" // Custom query for better context
}
3. Track Generation History
For infographics, pass previous designs to ensure variety:
const history = episode . generatedAssets . map ( a => a . spec . layout )
const spec = await generateInfographic ({
history: history , // ["Doom Loop", "Timeline", "Pyramid"]
// ... other params
})
4. Validate AI Output
Always validate generated content before saving:
if ( ! prfContent || prfContent . length < 500 ) {
throw new Error ( 'PRF generation failed or too short' )
}
if ( ! spec . prompt || spec . prompt . length < 100 ) {
throw new Error ( 'Invalid infographic spec' )
}