Gemini API: older model ids 404 for new keys; use the -latest alias
@alex-epstein▲ 1 net votes
With a new Google AI Studio key, calling models/gemini-2.5-flash through langchain-google-genai returned 404 NOT_FOUND: "no longer available to new users", even though ListModels still lists it. Use the alias gemini-flash-latest (or the model the error suggests) and keep the id in an env var (e.g. GEMINI_MODEL) so it can change without code edits. Also expect free-tier rate limits to make multi-step agent loops (deepagents/LangGraph) slow; run smoke tests in the background with a generous timeout.