> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 更新 KEY

> 更新既有 KEY 的名稱、到期時間、額度、模型／IP 限制及狀態。

## 請求參數

### 請求標頭

<ResponseField type="string" required>
  請求的身份驗證。本 API 使用 AIHubMix Manage Key 進行身份驗證。
</ResponseField>

<ResponseField type="string">
  請求的內容類型。此參數必須設定為 application/json。
</ResponseField>

### 路徑參數

<ParamField body="id" type="integer" required>
  KEY ID。
</ParamField>

### 請求主體

<ParamField body="name" type="string">
  新建立 Key 的名稱。
</ParamField>

<ParamField body="expired_time" type="integer">
  到期時間（UNIX 時間戳記），-1 表示永不過期。
</ParamField>

<ParamField body="unlimited_quota" type="boolean">
  是否為無限額度。true 表示無限制；false 表示啟用額度限制（需配合 remain\_quota）。
</ParamField>

<ParamField body="remain_quota" type="integer">
  剩餘額度。remain\_quota 應為：期望額度 \* 500000（例如，若期望額度為 10，則傳入 5000000）。當 unlimited\_quota 為 true 時，建議傳入 -1。
</ParamField>

<ParamField body="status" type="integer">
  Key 狀態。0 表示停用，1 表示啟用。
</ParamField>

<ParamField body="models" type="text">
  目前 Key 可使用的模型限制（為空或未提供表示無限制）。
</ParamField>

<ParamField body="subnet" type="text">
  IP 限制（為空或未提供表示無限制）。
</ParamField>

## 回應參數

<ResponseField name="success" type="boolean">
  表示請求是否成功。
</ResponseField>

<ResponseField name="message" type="string">
  請求失敗的詳細資訊。請求成功時可能為空或不傳回。
</ResponseField>

<ResponseField name="data" type="object">
  更新後的 Key 物件。

  <ResponseField name="id" type="integer" />

  <ResponseField name="user_id" type="integer" />

  <ResponseField name="status" type="integer" />

  <ResponseField name="name" type="string" />

  <ResponseField name="created_time" type="integer" />

  <ResponseField name="accessed_time" type="integer" />

  <ResponseField name="expired_time" type="integer" />

  <ResponseField name="remain_quota" type="integer" />

  <ResponseField name="unlimited_quota" type="boolean" />

  <ResponseField name="used_quota" type="integer" />

  <ResponseField name="models" type="text" />

  <ResponseField name="subnet" type="text" />
</ResponseField>

***

最後更新：2026-06-01
