# Google AI Studio 问题排查

如果您遇到问题，本页提供对 Google AI Studio 进行故障排除的建议。

## 了解 403 访问受限错误  {% #understand-403-errors %}

如果您看到 403 访问受限错误，则表明您使用 Google AI Studio 的方式不遵循 [服务条款](/docs/terms)。一个常见的原因是您不位于 [支持区域](/docs/available-regions).

## 验证您的 Google 帐户的年龄要求  {% #age-requirements %}

您必须是 18 或以上才能使用 Google AI Studio。您在尝试打开时可能会被重定向到此部分 [Google AI Studio](https://aistudio.google.com/)。如果是这样，请验证您的 Google 帐户是否符合年龄要求：

* **检查您的生日：** 确认您的出生日期设置为 18 或更早的日期 [生日设置](https://myaccount.google.com/birthday).
* **验证您的年龄：** 完成 [年龄验证](https://myaccount.google.com/age-verification) 在您的 Google 帐户上。有关验证选项，请参阅 [在您的 Google 帐户中验证您的年龄](https://support.google.com/accounts/answer/10071085).
* **匹配您的身份证出生日期：** 如果您使用身份证件验证年龄，请检查您的帐户设置。确保您的 [生日](https://myaccount.google.com/birthday) 与您身份证件上的日期一致。
* **Google Workspace 账户：** 对于 Google Workspace for Education 帐户，请联系您的管理员。他们可以确认您的帐户是否被指定为 18 或更旧的帐户。参见 [通过 Workspace 账号访问 Google AI Studio](/docs/workspace) 了解详情。

## 解决 Google AI Studio 上的“无内容”响应  {% #resolve-no-content %}

{% callout type="warning" %}
A **没有内容** 如果内容因任何原因被阻止，Google AI Studio 上会出现消息。要查看更多详细信息，请将指针悬停在 **没有内容** 然后单击 **安全**.
{% /callout %}

如果由于以下原因导致响应被阻止 [安全设置](/docs/safety-settings) 你考虑过 [安全风险](/docs/safety-guidance) 对于您的用例，您可以修改 [安全设置](/docs/safety-settings#safety-settings-ai-studio)
影响返回的响应。

如果响应被阻止但不是由于安全设置，则查询或响应可能违反 [服务条款](/docs/terms) 或以其他方式不受支持。

## 检查 token 的使用和限制  {% #check-token-usage %}

当您打开提示时， **文本预览** 屏幕底部的按钮显示当前用于提示内容的 token 以及所使用型号的最大 token 计数。

## Google Cloud AI Studio 的 IAM 权限  {% #iam-permissions %}

Google Cloud 项目的成员需要特定的身份和访问管理 (IAM) 权限才能在 Google AI Studio 中执行操作。有关这些身份的更多信息，请参阅 [IAM 主体概述](https://docs.cloud.google.com/iam/docs/principals-overview).

用户具有 **编辑** 或 **业主** 关联的 Google Cloud 项目中的角色具有查看仪表板和管理 Gemini API 密钥的完全权限。用户具有 **观众** 角色可以查看仪表板和 API 密钥，但无法创建、更新或删除它们。

如需更精细的控制，请参阅下表了解每个 AI Studio 功能所需的特定权限。有关如何授予这些权限的说明，请参阅 [授予、更改和撤销对资源的访问权限](https://cloud.google.com/iam/docs/granting-changing-revoking-access)
在 Google Cloud 文档中。

{% doc-table %}
{% doc-row header="true" %}
{% doc-cell %}
AI工作室功能
{% /doc-cell %}

{% doc-cell %}
所需的 IAM 权限
{% /doc-cell %}

{% doc-cell %}
附加要求
{% /doc-cell %}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**搜索项目** （进口项目）
{% /doc-cell %}

{% doc-cell %}
`resourcemanager.projects.get`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**重命名项目**
{% /doc-cell %}

{% doc-cell %}
`resourcemanager.projects.update`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**验证项目**
{% /doc-cell %}

{% doc-cell %}
`resourcemanager.projects.get`

`resourcemanager.projects.update`
{% /doc-cell %}

{% doc-cell %}
适用于免费套餐项目。参见 [项目与账号验证](/docs/verification#verify-project).
{% /doc-cell %}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**显示配额等级**
{% /doc-cell %}

{% doc-cell %}
N/A
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**创建 API 密钥**
{% /doc-cell %}

{% doc-cell %}
有 **搜索项目** 权限，以及：

`apikeys.keys.create`

`serviceusage.services.enable`

`iam.serviceAccountApiKeyBindings.create`

`iam.serviceAccounts.create`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**列表 API 密钥**
{% /doc-cell %}

{% doc-cell %}
有 **搜索项目** 权限，以及：

`apikeys.keys.list`

`serviceusage.services.get`
{% /doc-cell %}

{% doc-cell %}
Google Cloud 项目必须具有 [生成语言 API](https://console.cloud.google.com/apis/library/generativelanguage.googleapis.com) 已启用。
{% /doc-cell %}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**重命名API 密钥**
{% /doc-cell %}

{% doc-cell %}
`apikeys.keys.update`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**删除 API 密钥**
{% /doc-cell %}

{% doc-cell %}
`apikeys.keys.delete`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**使用情况仪表板**
{% /doc-cell %}

{% doc-cell %}
有 **搜索项目** 权限，以及：

`monitoring.timeSeries.list`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**速率限制仪表板**
{% /doc-cell %}

{% doc-cell %}
有 **使用情况仪表板** 权限，以及：

`cloudquotas.quotas.get`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**支出（计费上限）**
{% /doc-cell %}

{% doc-cell %}
`billing.resourceCosts.get` （查看支出）

`billing.resourcebudgets.read` （查看上限）

`billing.resourcebudgets.write` （设置上限）
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**计费仪表板**
{% /doc-cell %}

{% doc-cell %}
`billing.accounts.get`
{% /doc-cell %}

{% doc-cell /%}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**自定义域**
{% /doc-cell %}

{% doc-cell %}
`roles/owner` 或 `roles/editor`，或全部：

`roles/domains.admin`

`roles/dns.admin`

`roles/run.admin`

`serviceusage.services.get` 和 `serviceusage.services.enable` （如果尚未启用 Cloud Domains、Cloud DNS 和 Cloud Run API）
{% /doc-cell %}

{% doc-cell %}
需要有效的 Cloud Billing 帐户。参见 [Google AI Studio 自定义域名](/docs/aistudio-custom-domains).
{% /doc-cell %}
{% /doc-row %}

{% doc-row header="false" %}
{% doc-cell %}
**自定义域配额增加**
{% /doc-cell %}

{% doc-cell %}
`serviceusage.quotas.update` 或 `cloudquotas.quotas.update`
{% /doc-cell %}

{% doc-cell %}
需要有效的 Cloud Billing 帐户。参见 [请求额外的域](/docs/aistudio-custom-domains#request-additional-domains).
{% /doc-cell %}
{% /doc-row %}
{% /doc-table %}

### 其他访问检查  {% #other-access-checks %}

除了Google Cloud IAM权限之外，AI Studio还执行安全性和合规性检查。你可能会遇到一个 `PERMISSION_DENIED` 如果您不满足以下要求，则 AI Studio 界面或 API 响应中会出现访问限制错误：

* **安全检查：** 您的请求必须通过自动安全检查。
* **移动设备验证：** 一些免费层项目和具有异常活动的帐户必须完成 [项目或账户验证](/docs/verification).
* **服务条款：** 您必须接受 Google 服务条款和 Generative AI 附加服务条款。
* **支持地区：** 您必须位于 [支持区域](/docs/available-regions).
* **年龄要求：** 您必须满足 [年龄要求](/docs/troubleshoot-ai-studio#age-requirements) (18+) 在您的 Google 帐户上。
* **信任与安全：** Google Cloud 项目不得被标记为滥用。
