import { createClient } from 'v0-sdk'; const V0_API_KEY = ''; const v0 = createClient({ apiKey: V0_API_KEY }); const deleteAllV0Chats = async () => { console.log('Fetching all your V0 chats...'); try { const chatsResponse = await v0.chats.find(); const chats = chatsResponse.data || []; if (chats.length === 0) { console.log('No chats found in V0'); return; } console.log(`Found ${chats.length} chats\n`); let successCount = 0; let failCount = 0; for (const chat of chats) { console.log(`Processing: ${chat.name || 'Unnamed chat'} (ID: ${chat.id})`); console.log(` Created: ${new Date(chat.createdAt).toLocaleString()}`); if (chat.webUrl) { console.log(`URL: ${chat.webUrl}`); } try { await v0.chats.delete({ chatId: chat.id }); console.log('Successfully deleted'); successCount++; } catch (error) { console.error(`Failed to delete: ${error}`); failCount++; } console.log(); } console.log(`${'='.repeat(50)}`); console.log('Summary:'); console.log(`Successfully deleted: ${successCount}`); console.log(`Failed: ${failCount}`); console.log(`Total processed: ${chats.length}`); } catch (error) { console.error(`error: ${error}`); } }; const main = async () => { console.log(`This script will DELETE all your V0 chats`); await deleteAllV0Chats(); }; main().catch((error) => { console.error(`Unhandled error: ${error}`); });