import { NextRequest, NextResponse } from 'next/server'; /** * Test endpoint to check if HF_TOKEN is available * Useful for debugging token configuration */ export async function GET(request: NextRequest) { const token = process.env.HF_TOKEN || process.env.HUGGINGFACE_TOKEN || process.env.HF_API_TOKEN || process.env.HUGGING_FACE_HUB_TOKEN || null; const envKeys = Object.keys(process.env).filter(k => k.includes('HF') || k.includes('TOKEN') || k.includes('HUGGING') ); return NextResponse.json({ tokenFound: !!token, tokenLength: token ? token.length : 0, tokenPrefix: token ? token.substring(0, 10) + '...' : null, checkedVariables: [ 'HF_TOKEN', 'HUGGINGFACE_TOKEN', 'HF_API_TOKEN', 'HUGGING_FACE_HUB_TOKEN' ], availableEnvVars: envKeys, allEnvVarsCount: Object.keys(process.env).length, }, { headers: { 'Cache-Control': 'no-store', } }); }