It's not the v1beta endpoint issue, you are using a retired Gemini model (see the retired models), retired on 9/24/2025, for both Gemini 1.5 (pro and flash). That's the reason of getting 404 NOT FOUND error (in either Vertex AI or AI Studio). You should migrate to Gemini 2.0/2.5 Flash and later instead following the latest Gemini migration guide.