Gemini 3.8 Flash Works in AI Studio Playground but Direct API Requests Return HTTP 503

Hello Google AI Developers Community,

I’m developing an AI-powered business automation product using the Gemini API, and I’m experiencing persistent HTTP 503 UNAVAILABLE errors when making direct API requests.

What’s particularly confusing is that the same Gemini model works successfully in Google AI Studio Playground.

I’ve spent considerable time isolating the issue and would appreciate some technical guidance.

1. My development environment

  • Operating System: Windows 11

  • Runtime: Node.js / TypeScript

  • SDK: @google/genai 3.6.1

  • Google AI Studio project: Dedicated project on the Free tier

  • Model: gemini-3.8-flash

  • Authentication: Gemini API key generated through Google AI Studio

  • Billing: No billing account attached.

2. The most important observation: Playground works

In Google AI Studio Playground, I selected gemini-3.8-flash and successfully performed two tests:

Test 1 — Plain text generation

Prompt:
“Reply with exactly one word: OK”

Result: Successfully returned “OK”.

Test 2 — Structured JSON generation

I enabled Structured Outputs and supplied this minimal JSON schema:

{
“type”: “object”,
“properties”: {
“ok”: {
“type”: “boolean”
}
},
“required”: [“ok”]
}

Prompt:
“Return a JSON object with ok set to true.”

Result:

{
“ok”: true
}

Both tests succeeded.

3. Direct Gemini API tests

However, when I perform equivalent minimal tests through my application, I repeatedly receive HTTP 503.

Test A — GenerateContent API

Model: gemini-3.8-flash

Minimal synthetic prompt and JSON schema.

Result:
HTTP 503 — UNAVAILABLE.

Test B — Alternative model

Model: gemini-3.6-flash

Same minimal structured-output request.

Result:
HTTP 503 — UNAVAILABLE.

Test C — Interactions API

Model: gemini-3.8-flash

I implemented a separate diagnostic using:

ai.interactions.create()

Configuration:

  • Minimal synthetic prompt.

  • Minimal JSON schema.

  • store: false.

  • automatic_continuation: false.

  • SDK retries explicitly disabled.

Result:
HTTP 503 — UNAVAILABLE.

4. Additional findings

I also tested the full structured interpretation request used by my application.

One attempt returned HTTP 400 INVALID_ARGUMENT, while another returned HTTP 503.

To eliminate schema complexity as the explanation for the repeated 503 errors, I created a completely separate minimal-schema diagnostic probe.

The minimal request still returns HTTP 503.

All tests use synthetic data. No real customer information is involved.

5. What I have already investigated

  • Verified that the Gemini API key is present in the local environment.

  • Confirmed that the project is configured for the Free tier.

  • Verified that the installed SDK supports both GenerateContent and Interactions.

  • Inspected the structured-output configuration and JSON schema.

  • Implemented independent diagnostic probes for both APIs.

  • Disabled automatic retries to isolate individual failures.

  • Confirmed that both probes execute exactly one request.

6. Questions for Google

I would appreciate clarification on the following:

  1. Why does Gemini 3.8 Flash work successfully in AI Studio Playground but return HTTP 503 through direct API requests?

  2. Can there be differences in model-serving availability between Playground requests and requests authenticated through an API key?

  3. Could my project’s Free-tier provisioning, account eligibility, regional availability, or API access configuration be contributing to this behaviour?

  4. Is there any additional diagnostic information I should collect to help identify the cause?

  5. Is there a recommended way to resolve persistent HTTP 503 errors when minimal requests fail across both GenerateContent and Interactions APIs?

I understand that HTTP 503 can indicate temporary service overload. However, the repeated failures across multiple models and both API interfaces, alongside successful Playground generation, make me concerned that something else may be happening.

I’d appreciate any guidance from Google developers or community experts who have encountered this behaviour.

Thank you.

Additional update:

I’ve performed another controlled experiment using Google’s Interactions API.

Using the same Google AI Studio project and configured Gemini API key, I sent a single synthetic request through:

ai.interactions.create()

Configuration:

  • Model: gemini-3.8-flash

  • SDK: @google/genai 3.6.1

  • Minimal JSON schema

  • Synthetic prompt only

  • store: false

  • Automatic continuation disabled

  • Automatic retries disabled

Result:

HTTP 503 — UNAVAILABLE

Latency: approximately 2.1 seconds.

This means both GenerateContent and Interactions API requests have now independently returned HTTP 503, even with minimal synthetic inputs.

However, both plain-text and structured JSON generation continue to work successfully in Google AI Studio Playground using Gemini 3.8 Flash.

Could you clarify whether this discrepancy between Playground and direct Gemini Developer API requests is expected under certain Free-tier serving conditions?

Hello @Hasnat_Saddam,

503 errors are due to our services being temporarily overloaded. Please see this pinned post for suggestions on how to handle this.