Gemini API_KEY_INVALID in GitHub Actions with fresh AI Studio key — gemini-2.5-flash

Hi everyone,

I’m building a small B2B automotive spare-parts price research system called PartPulse. I’m integrating the Gemini API into a Node.js application running through GitHub Actions.

I’m currently getting API_KEY_INVALID from Gemini for every request.

Environment

  • Gemini model: gemini-2.5-flash

  • Runtime: Node.js 24

  • Execution: GitHub Actions (ubuntu-latest)

  • API key: newly generated Gemini API key

  • The key is stored as a GitHub Actions repository secret named GEMINI_API_KEY

  • The workflow confirms that the secret is present (without printing its value)

  • The key itself is never printed or exposed

  • The Gemini API is enabled for the Google Cloud project

  • We are making normal text-generation requests

The GitHub Actions environment successfully receives the secret, but every Gemini request fails.

Our diagnostic output is:

DUO DIAGNOSTICS: Luna errors=20, Gemini errors=20

and:

Both agents responding: 0

The application is designed to query both OpenAI and Gemini independently for the same 20 automotive part numbers. OpenAI currently has a separate billing/credit issue, but Gemini is also failing independently with API_KEY_INVALID.

What I want to understand

Could someone confirm the correct configuration for a Gemini API key used from GitHub Actions with gemini-2.5-flash?

Specifically:

  1. Does a key created in Google AI Studio require any additional Google Cloud configuration before it can be used from GitHub Actions?

  2. Should the key be restricted to the Gemini API only?

  3. Is a service account required for this type of API-key request?

  4. Is gemini-2.5-flash currently supported through the Gemini Developer API for this setup?

  5. Is there a recommended minimal Node.js request we can use to prove that the key itself works before debugging our application?

  6. Could API_KEY_INVALID indicate a project/API configuration problem even when the key exists and is correctly injected into the GitHub Actions environment?

I can provide the sanitized request code and full error response if useful. I will not post the API key itself.

Thanks.