#!/usr/bin/env node // Node 18+ has native fetch const testData = { characterName: "Test Character", actorName: "Test Actor", actorAge: 15, productionTitle: "Test Production", productionType: "Feature Film", roleSize: "Supporting", genre: "Drama", storyline: "A test storyline", characterBreakdown: "A test character breakdown", sceneText: "INT. TEST ROOM - DAY\n\nTEST CHARACTER\nThis is a test line." }; async function testAPI() { console.log('Testing Prep101 API...\n'); try { const response = await fetch('https://prep101-api.vercel.app/api/clawdbot/generate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': 'clawdbot_sk_live_5928349283749238' }, body: JSON.stringify(testData) }); console.log('Status:', response.status); if (!response.ok) { const errorText = await response.text(); console.error('Error response:', errorText); process.exit(1); } const result = await response.json(); console.log('✅ API call successful!'); console.log('Response keys:', Object.keys(result)); if (result.guideHtml) { console.log('\n✅ HTML guide generated'); console.log('HTML length:', result.guideHtml.length, 'characters'); } if (result.guidePlainText) { console.log('✅ Plain text guide generated'); console.log('Text length:', result.guidePlainText.length, 'characters'); } // Save test output const fs = require('fs'); fs.writeFileSync('/root/.openclaw/workspace/Projects/Casting/Output/API_Test_Guide.html', result.guideHtml); console.log('\n✅ Test guide saved to: Projects/Casting/Output/API_Test_Guide.html'); } catch (error) { console.error('❌ API test failed:', error.message); process.exit(1); } } testAPI();