AI Studio image upload fails: CountTokens preflight returns 403 for two request headers

Uploading an image in Google AI Studio shows “Token count failed”.

Model: gemini-3-pro-image
The issue also occurs in Chrome Incognito.
The project has active Tier 1 billing and a positive prepaid balance.

The OPTIONS preflight to:

returns 403 when Access-Control-Request-Headers includes either:

  • x-aistudio-quota-tier
  • x-aistudio-visitor-id

Using the same proxy and endpoint, removing both headers returns
200 with valid Access-Control-Allow-Origin headers.

Please check the CORS configuration for these headers.

Thanks for the report - this should be fixed now.