# Solving Gemini API key errors in Discourse

**URL:** https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545
**Category:** Self-hosting
**Tags:** ai
**Created:** [September 3, 2026, 4:43am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545 "2026-09-03T04:43:15Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 3, 2026, 4:43am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/1 "2026-09-03T04:43:15Z")

</div>

How do I connect Google Cloud AI for Discourse AI.

I tried the steps mentioned in the post

> [@Set up Gemini API Keys for Discourse AI](https://meta.discourse.org/t/set-up-gemini-api-keys-for-discourse-ai/320688):
>
> How to Set Up Gemini API Keys for Discourse AI Introduction This topic covers how to set up your Google Gemini API key with an existing Google Cloud account project. Gemini is not a free service, and therefore, you will need to ensure you have billing configured in your Google Cloud admin. There is some important information with links in the [Gemini Developer studio](https://aistudio.google.com/) key generating page about this:

but GCP interface has changed.

I tried what’s mentioned at

> **[Setting up a Gemini API key on a Google Cloud service account](https://disco-docs.com/t/setting-up-a-gemini-api-key-on-a-google-cloud-service-account/423?u=lilly)**
>
> How to set up a Gemini api key on a Google Cloud service account Step 1: set up the service account go to your Google Cloud IAM and admin page and select +create service account at the top menu: follow the prompts and fill out the info: ...

But still encountering the following error

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/2/f/52f13095fab43439050083545a2d9cde678c625d.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/d/0/bd03b49b312b335c39e4fc27288e61e721fe3810.png)

For now I’m using a workaround (Google Cloud Run → vLLM) but latency is very high with that method.

Can someone tell me how do I fix this error? I want to use one of the AI models available on GCP as the default LLM.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 4, 2026, 1:49am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/2 "2026-09-04T01:49:43Z")

</div>

why are you using vertex AI?

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [September 4, 2026, 1:55am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/3 "2026-09-04T01:55:19Z")

</div>

I used it ln Discourse through LiteLLM proxy. They offer 300 USD in free bonus credits.

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 4, 2026, 2:13am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/4 "2026-09-04T02:13:30Z")

</div>

@Lilly I also have credits in GCP that’s why I’m trying to connect via Vertex.  
@satonotdead Do you experience any latency with LiteLLM method?

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 4, 2026, 2:16am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/5 "2026-09-04T02:16:01Z")

</div>

i’ve never set it up using vertex. it works perfectly fine though using gemini api service. i just walked through the configuration and i see no change in the google cloud dashboard for the apis and services and for configuration of credentials. 🤷🏻‍♀️

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 4, 2026, 2:18am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/6 "2026-09-04T02:18:21Z")

</div>

> [@Karthik\_K1](#):
>
> ![image](https://global.discourse-cdn.com/meta/original/4X/b/d/0/bd03b49b312b335c39e4fc27288e61e721fe3810.png)
> 
> image1052×172 27.5 KB

did you see the documentation that is quoted there? what does it tell you?

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 4, 2026, 2:26am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/7 "2026-09-04T02:26:28Z")

</div>

If I use the Gemini method, it will not use the credits I have because it will connect me to Gemini AI Studio, which cannot utilize the credits in GCP.

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/b/c/fbc41eaa041a2b8a3317b9bbbd1d00d919a0e0fe.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/9/3/f93384377e5725ba004a64e40c4a6950a1fc5b1e.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 4, 2026, 2:27am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/8 "2026-09-04T02:27:05Z")

</div>

> [@Karthik\_K1](#):
>
> Gemini AI Studio

i don’t even use this

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 4, 2026, 2:28am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/9 "2026-09-04T02:28:10Z")

</div>

Can you share a screenshot of your configuration?

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 4, 2026, 2:31am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/10 "2026-09-04T02:31:58Z")

</div>

i just did a new configuration of gemini flash 3.6 and all i had to add to do was set the api key to use (which in my case is called `2026-07-02`). i didn’t change anything else from the default setup for flash 3.6 and it tested successfully and worked fine:

 ![Screenshot 2026-09-03 at 7.28.53 PM](https://global.discourse-cdn.com/meta/original/4X/a/9/9/a99db311e3b75a494ee1afe9226b36392657575c.png)  
 ![Screenshot 2026-09-03 at 7.29.21 PM](https://global.discourse-cdn.com/meta/original/4X/f/6/9/f69f6b39e4ce85da77bc780ed81bb4c0b3bc2b40.png)

but the api key credential is using the gemini api service, not vertex.

my GCP configuration looks exactly like what you linked in the disco-docs screenshots (those are screenshots of my GCP config!).

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 4, 2026, 2:35am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/11 "2026-09-04T02:35:55Z")

</div>

Yes, this method works, but it will not allow me to use the GCP credits I already have.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 4, 2026, 2:38am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/12 "2026-09-04T02:38:53Z")

</div>

ok so the credits are limited to vertex ai then?

i am just using my paid GCP with a service account and gemini api - very straightforward.

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 4, 2026, 2:45am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/14 "2026-09-04T02:45:35Z")

</div>

Yes, credits work with the Vertex method only. I’m able to use Vertex AI by logging into GCP but unable to connect it with Discourse as there’s some mismatch in the authentication method that GCP accepts and what Discourse follows, as per my understanding. That’s why I created a LiteLLM proxy for now, but there’s some latency with that method.

---

<div class="post-metadata">

### Author: ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)
#### Post date: [September 4, 2026, 7:21am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/15 "2026-09-04T07:21:50Z")

</div>

> [@Karthik\_K1](#):
>
> @atonotdead Do you experience any latency with LiteLLM method?

Not at all, and I also used a Nginx internal proxy with a script to rotate the token login on Vertex.

LiteLLM is really good if you have plans to deploy more keys, MCP servers and want to use more LLM endpoints.

You can use almost any subscription tier as LLM API with it.

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 5, 2026, 5:51am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/16 "2026-09-05T05:51:04Z")

</div>

I switched to a lighter model, and there’s no latency now. Thanks.

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [September 5, 2026, 5:53am UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/17 "2026-09-05T05:53:46Z")

</div>

Closing this topic, though the Vertex method is not working, as the LiteLLM workaround is fine.
