---
title: "Key, Access, and Period time"
description: "Keep credential expiry, access entitlement, and quota reset as three independent lifecycle boundaries."
---

> Documentation Index
> Fetch the complete documentation index at: https://nexus.microvoid.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Key, Access, and Period time

## Outcome

你可以诊断“Key 有效但请求仍被拒绝”等时间问题，并在轮换、续期或套餐变更时避免意外重置额度。

| Boundary                       | Meaning                      | Owner                         |
| ------------------------------ | ---------------------------- | ----------------------------- |
| `ApiKey.expiresAt`             | 凭证安全过期时间。           | Better Auth API Key lifecycle |
| `WorkspaceAccess.accessEndsAt` | 套餐访问权的截止时间。       | Nexus Access lifecycle        |
| `QuotaPeriod.periodEnd`        | 当前额度周期结束或重置时间。 | Nexus Quota lifecycle         |

一次请求必须同时满足：Key enabled 且未过期、WorkspaceAccess 为 ACTIVE 且处于 Access 时间范围、QuotaPeriod 为当前 ACTIVE 周期且有足够 Available Units。

## Why they remain separate

- 30–90 天 Key 安全轮换不应改变用户购买的访问周期。
- 套餐续期不应强制客户端立即更换仍安全的 Key。
- Quota 重置不应把已撤销 Credential 重新启用。
- Plan 策略更新默认影响下一 QuotaPeriod，不改写正在结算的快照。

## Lifecycle effects

| Operation            | Key                    | Access             | Current QuotaPeriod                |
| -------------------- | ---------------------- | ------------------ | ---------------------------------- |
| Rotate Inference Key | 新建 Key，撤销旧 Key。 | 不变。             | 不变。                             |
| Suspend Access       | Key 记录可以继续存在。 | `SUSPENDED`。      | 历史与余额保留，但新请求被拒绝。   |
| Renew Access         | 不自动延长 Key TTL。   | 更新 Access 时间。 | 幂等创建或延续正确的新 Period。    |
| Change plan          | 不要求换 Key。         | 绑定新 Plan。      | ACTIVE Period 保留创建时策略快照。 |
| Period rollover      | 不启用过期 Key。       | 不变。             | 关闭旧 Period，创建新的额度快照。  |

## Diagnose a rejected request

按顺序检查 Key 状态与 `expiresAt`、WorkspaceAccess 状态与 `accessEndsAt`、QuotaSnapshot 的 `periodEnd` 和 `availableUnits`。错误响应中的 Request ID 用于关联 Usage 与 Audit；不要只通过重新签发 Key 掩盖 Access 或 Period 问题。

## Next steps

- [Quota periods](/docs/control-plans-and-quota/quota-periods)
- [Reserve, settle, and release](/docs/control-plans-and-quota/reserve-settle-release)

Source: https://nexus.microvoid.io/docs/give-users-access/time-boundaries/index.mdx
