Paid API key fails in AI Studio — ESF returns HTTP 403 on CORS OPTIONS preflight (`x-aistudio-*` headers)

Category: Google AI Studio / Bug

Description:
Many developers on paid Prepay and Tier 1/2 accounts are experiencing a persistent platform bug where submitting any prompt in the Google AI Studio web UI instantly triggers “An internal error has occurred” and “Failed to generate content.”

After HAR analysis and network diagnostics, I have isolated the exact root cause:

Technical Root Cause

When a paid API key is selected in the AI Studio web interface, the frontend application client injects custom headers (such as x-aistudio-quota-tier, x-aistudio-user-api-key, x-aistudio-visit-id, and x-goog-ext-5197338..-bin) into XHR requests destined for the internal gRPC-Web proxy (alkalimakersuite-pa.clients6.google.com).

Google’s Edge Server Frontend (ESF) has not whitelisted these new x-aistudio-* headers in the Access-Control-Allow-Headers configuration for alkalimakersuite-pa. Consequently:

  1. The browser’s CORS OPTIONS preflight request is rejected by ESF with an HTTP 403 Forbidden response.
  2. Chrome immediately aborts the actual POST request (net::ERR_FAILED, status code 0).
  3. The AI Studio web client catches this aborted RPC and displays the generic internal error banner.

Proof & Verification

  • Web UI Fails: OPTIONS preflights to alkalimakersuite-pa.clients6.google.com listing the x-aistudio-* headers return HTTP 403.
  • Preflight Succeeds When Stripped: An identical OPTIONS preflight without the x-aistudio-* headers returns HTTP 200 OK.
  • Direct API Works: Direct REST API requests to generativelanguage.googleapis.com/v1beta/models/... using the exact same API keys and project credentials succeed with HTTP 200 OK, proving that the GCP projects, billing ledgers, and API keys are fully functional.

Request to Engineering

Please update the CORS preflight header whitelist on alkalimakersuite-pa.clients6.google.com to accept the x-aistudio-* auxiliary headers introduced in recent frontend builds, or roll back the header injection for paid web playground sessions.

Thank you!

Thanks for the report. I’ve raised this as a P0, hopefully we’ll get it resolved soon.

Thanks again for the report. This is now fixed.

I can confirm now fixed. Much appreciated!