I am building a frontend web application (Vanilla JS) that uploads images and uses the Gemini API (gemini-2.5-flash) to generate SEO metadata (title, description, keywords) in JSON format.
My project is linked to a Google Cloud Billing account (Paid Tier enabled). However, when processing multiple images in a loop (even with a 2-4 second delay between requests), the API frequently fails with a 503 Service Unavailable error.
Because the server returns a 503 without proper CORS headers, the browser interprets it as a CORS error, breaking the fetch request completely.