---
title: "Cookbook"
description: "Complete recipes for provisioning users, integrating clients, rotating credentials, and diagnosing requests."
---

> 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.

# Cookbook

## Outcome

从任务结果进入一份可复制的实现，不需要先理解所有 Nexus 领域对象。每份 Recipe 都说明凭证平面、生命周期影响、验证方式和常见失败。

## Provision and operate users

- **Provision Free and Pro users** — 创建两个 Plan/QuotaStrategy，并为应用用户签发一次性 Inference Key。
- **Rotate an inference key** — 先签发、切流，再撤销旧 Key；Access、Plan 和 QuotaPeriod 保持不变。
- **Suspend and reactivate access** — 在 Provider 调用前阻断新请求，并在恢复后保留历史 Usage/Audit。

## Integrate clients

- **OpenAI JavaScript** — 只替换 Base URL 和 Key，运行 E2E 使用的完整 JavaScript 源码。
- **OpenAI Python** — 同时验证普通请求、Streaming 和末尾 Usage。
- **OpenCode** — 使用环境变量保存 Key，并保留 Provider 原始模型名。

## Operate capacity and incidents

- **Rotate a provider secret** — 保持 ProviderConnection ID、用户 Base URL 和 Inference Key 不变。
- **Diagnose quota and metering** — 区分 Access、Quota、Inspector 与 Provider 层，按 Request ID 追踪。
- **Troubleshooting** — 从稳定 Gateway 错误码判断 Provider 是否被调用以及能否重试。

Source: https://nexus.microvoid.io/cookbook/index.mdx
