# 解决 Discourse 中的 Gemini API 密钥错误

**URL:** https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545
**Category:** Self-hosting
**Tags:** ai
**Created:** [2026年九月3日 04:43 UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545 "2026-09-03T04:43:15Z")
**Posts on this page:** 1
**Showing post:** 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: [2026年九月3日 04:43 UTC](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545/1 "2026-09-03T04:43:15Z")

</div>

如何将 Google Cloud AI 连接到 Discourse AI？

我尝试了帖子中提到的步骤：

> [@为 Discourse AI 设置 Gemini API 密钥](https://meta.discourse.org/t/set-up-gemini-api-keys-for-discourse-ai/320688):
>
> 如何为 Discourse AI 设置 Gemini API 密钥 简介 本主题介绍如何将您的 Google Gemini API 密钥与现有的 Google Cloud 账户项目关联起来。Gemini 不是免费服务，因此您需要确保在 Google Cloud 管理中配置了结算。 在生成密钥的 [Gemini 开发者工作室](https://aistudio.google.com/) 页面上有关于此的一些重要信息，其中包含链接： 好的，让我们开始吧！ point_up 注意：需要 Google Cloud 和您的 Discourse 论坛的管理员级别访问权限。 步骤 1：设置 Google Cloud 项目 正确设置 Gemini API 密钥需要您拥有对 Google Cloud 账户的管理员访问权限，并在此处创建一个可用于 Gemini API 密钥使用的结算项目。 您可以在 Gemini Studio 中创建密钥并连接到您的 Google Cloud，但从 Google Cloud 控制台进行所有操作会稍微简单一些，这样…

但 GCP 界面已经发生了变化。

我也尝试了以下链接中提到的方法：

> **[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: ...

但仍然遇到以下错误：

 ![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)

目前我在使用一种变通方案（Google Cloud Run → vLLM），但该方法的延迟非常高。

有人能告诉我如何修复这个错误吗？我想将 GCP 上可用的 AI 模型之一作为默认 LLM 使用。

---

_[View the full topic](https://meta.discourse.org/t/solving-gemini-api-key-errors-in-discourse/411545)._
