# 创建 AI 网关

## 操作步骤

{% stepper %}
{% step %}
**登录**

前往 [**zenConsole**](https://console.zenlayer.com/) 并使用你的账号登录。在左侧菜单栏中，进入 **产品** > **GPU & AI** > **AI 网关**，然后点击 **创建 AI 网关**。

<div align="left" data-with-frame="true"><figure><img src="/files/U8d0y7pQkozSmgcPJM8f" alt="" width="491"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**配置 Token 配额**

Token 是模型处理文本的基本单位。Token 配额定义了该 API 密钥可使用的最大 Token 数量，**包括所有 Token 类型**，例如输入 Token、输出 Token、缓存 Token，以及请求处理过程中消耗的任何其他 Token。

默认情况下，Token 配额为无限制。如果你希望限制该 API 密钥可消耗的最大 Token 数量，请取消勾选 **无限配额**。

**使用上限示例**

例如，如果你将 Token 配额设置为 **1,000,000 Tokens**：

* 该 API 密钥总共最多可消耗 1,000,000 个 Token
* 一旦达到配额上限，该 API 密钥将被自动暂停
* 在更新配额之前，将不允许继续消耗 Token 或发起 API 请求

<div align="left" data-with-frame="true"><figure><img src="/files/DmiGWQX5eNXEAtaFhemK" alt="" width="480"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
*<mark style="color:green;">**（可选）**</mark>***&#x20;配置 API 密钥过期时间**

你可以为临时访问或项目型访问设置一个过期时间。

可选值包括：`7 天`、`30 天`、`60 天`、`90 天`、`长期有效` 和 `自定义`。

留空则表示永久有效。
{% endstep %}

{% step %}
**设置 AI 网关名称**

为你的 AI 网关实例设置一个标识名称。
{% endstep %}

{% step %}
**更多设置**

你可以将 AI 网关实例加入到指定的资源组中。在资源组内，可以为特定成员授予资源的相应权限。

更多信息请参见 [创建资源组](/welcome/cn/platform/team-management/create-a-resource-group.md)。
{% endstep %}

{% step %}
**完成创建**

确认并同意 AI 网关相关条款，然后点击 ***创建*** 以创建 AI 网关。
{% endstep %}
{% endstepper %}

## 结果

创建完成后，你将获得一个 **API** 密钥，该密钥将用于后续所有 API 调用。你可以查看 [**API 文档**](https://docs.console.zenlayer.com/api-reference/compute/aig) 了解所有相关 API 接口。

请复制该访问密钥并妥善保存。

<div align="left" data-with-frame="true"><figure><img src="/files/Y5S4ldwhOncvdWOKXANp" alt="" width="343"><figcaption></figcaption></figure></div>

## 下一步操作

点击 AI 网关名称，进入详情页面以查看日志、数据分析和基础信息。

如有需要，你也可以在 **更多操作** 中执行以下操作：

### 管理 Token 配额

取消勾选 **无限配额** 以输入配额上限。

<div align="left" data-with-frame="true"><figure><img src="/files/STcEap6btOYbAsoiu7mI" alt="" width="339"><figcaption></figcaption></figure></div>

### 管理过期时间

选择所需的 API 密钥过期时长。

<div align="left" data-with-frame="true"><figure><img src="/files/AByROvszttRMFYoPSwSy" alt="" width="333"><figcaption></figcaption></figure></div>

### 复制 AI 网关

点击 ***复制 AI 网关***，即可创建一个配置相同的 AI 网关。

### 删除

如果你不再需要该 AI 网关，点击 ***删除*** 即可删除。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/cn/ai-gateway/create-an-ai-gateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
