Hello,
We are investigating a persistent HTTP 404 / NOT_FOUND when calling the Gemini Developer API from a server-side Python application.
Our application uses Python’s http.client over HTTPS directly, without an SDK. It targets the global Gemini Developer API, not Vertex AI.
Generation request:
POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
Headers:
- Content-Type: application/json
- x-goog-api-key: [REDACTED]
The JSON body contains systemInstruction, contents with user/model text parts, and generationConfig. Generation settings include candidateCount: 1, a bounded maxOutputTokens value, and thinkingConfig.thinkingBudget: 0. There are no uploaded-file references or tools.
Observed results:
- The generation request returned HTTP 404 with status NOT_FOUND at approximately 2026-09-21 21:30:33 UTC.
- A subsequent metadata request using the same saved credential returned HTTP 200 at approximately 2026-09-21 22:25:31 UTC:
GET https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash - The metadata identified models/gemini-2.5-flash, version 001, and listed generateContent among its supportedGenerationMethods.
Checks completed:
- generativelanguage.googleapis.com is enabled for the project.
- AI Studio shows Tier 1 prepaid billing with a positive credit balance.
- The billing support assistant reported that the billing account is active, correctly standing, and has no payment restrictions.
- The AI Studio authorization key is bound to an enabled service account.
- The key’s API restriction includes Gemini API, with no application restriction configured.
- The adapter uses exactly one models/ prefix, with no regional endpoint, redirects, or automatic retries.
Diagnostic limitation:
Our application’s error filter retained the numeric code 404 and status NOT_FOUND, but replaced the provider’s detailed message with “Provider message withheld.” That phrase is generated by our application, not Google. We therefore do not have the original error message available.
Could you advise what could explain successful model metadata retrieval but failed generateContent execution with the same credential? In particular, are there additional requirements or known issues affecting service-account-bound AI Studio authorization keys for this endpoint?
Please advise the most useful next diagnostic step and whether a private channel is available for any account-specific investigation. We can provide additional sanitized request details.