1 ファイル変更+5-0
この更新の概要
TypeScript向けのAgent SDKにおいて、クレジット不足によるリクエスト拒否を扱うための新しいプロパティが追加されました。これにはerrorCode、canUserPurchaseCredits、hasChargeableSavedPaymentMethodの3つのフィールドが含まれます。これらのプロパティにより、ユーザーがクレジットを購入可能か、または有効な支払い方法が登録されているかをプログラム側で判定できるようになります。この変更を反映するには、Claude Code v2.1.181以降のバージョンが必要です。
@@ -3257,12 +3257,17 @@ type SDKRateLimitEvent = {
status: "allowed" | "allowed_warning" | "rejected";
resetsAt?: number;
utilization?: number;
errorCode?: "credits_required";
canUserPurchaseCredits?: boolean;
hasChargeableSavedPaymentMethod?: boolean;
};
uuid: UUID;
session_id: string;
};
```
When `errorCode` is `"credits_required"`, the rejection is from a claude.ai subscription whose included usage is exhausted, and the session cannot continue until the user buys usage credits. `canUserPurchaseCredits` indicates whether the authenticated user can buy credits for the account, and `hasChargeableSavedPaymentMethod` indicates whether a saved payment method is on file. All three fields are absent on rate-limit events that are not credits-required rejections. Requires Claude Code v2.1.181 or later.
### `SDKLocalCommandOutputMessage`
Output from a local slash command (for example, `/voice` or `/usage`). Displayed as assistant-style text in the transcript.