As of September 24, 2025, Gemini 1.5 (pro and flash) were retired and became a legacy model. That's why you are getting the 404 error when using the retired models. You should migrate to Gemini 2.0/2.5 Flash and later instead. Please follow the latest Gemini migration guide to migrate.