const path = require('path'); process.chdir('/var/www/zeropost-engine'); require('dotenv').config({ path: '/var/www/zeropost-engine/.env' }); const axios = require('axios'); const config = require('/var/www/zeropost-engine/src/config'); (async () => { const prompt = `A small friendly emerald green geometric mascot character, soft rounded square shape, two simple black dot eyes, small smile, flat vector illustration style, warm off-white background. No text.`; const wrapped = `Use the image_generation tool to create the following illustration. Do not write any text response, only call the tool.\n\n${prompt}`; try { const res = await axios.post( `${config.ai.baseUrl}/responses`, { model: process.env.AI_MODEL_IMAGE_VIA_RESPONSES || 'gpt-5.2', input: wrapped, tools: [{ type: 'image_generation' }], tool_choice: { type: 'image_generation' }, }, { headers: { Authorization: `Bearer ${config.ai.imageApiKey}` }, timeout: 300_000 } ); console.log('output types:', (res.data?.output || []).map(o => o.type)); const imgCall = (res.data?.output || []).find(o => o.type === 'image_generation_call'); if (imgCall) console.log('status:', imgCall.status, 'has result:', !!imgCall.result); else console.log('full:', JSON.stringify(res.data).slice(0, 500)); } catch (e) { console.error('FAIL:', e.response?.data || e.message); } })();