メインコンテンツへスキップ

Regular Key セルフサービス照会

Regular Key のみ受け付け、所属アカウントの現在の総残高と現在の Key の残高情報を返します。

以下の Regular Key 状態でも照会が可能で、200 を返します:

  • 手動無効化;
  • 期限切れ;
  • 額度枯渇;
  • サブスクリプション有効化待ち。

削除済み・偽造・認識できない Key は 401 invalid_api_key を返します。アカウントが無効化されている場合は 403 account_disabled を返します。

リクエストパラメータ: なし

レスポンス例

{
"object": "self_balance",
"currency": "USD",
"as_of": "2026-08-08T06:30:00Z",
"account": {
"total_balance": "850",
"paid_balance": null,
"free_balance": null,
"breakdown_status": "unavailable"
},
"key": {
"id": "key_01JPRODUCTION",
"name": "Production Server",
"key_type": "regular",
"disabled": false,
"manually_disabled": false,
"limit": "200",
"limit_reset": "monthly",
"quota_scope": "usage",
"period": {
"start": "2026-07-21T08:30:00Z",
"end_exclusive": "2026-08-21T08:30:00Z"
},
"consumed_this_period": "85.5",
"consumed_today": "2.3",
"key_limit_remaining": "114.5",
"remaining": "114.5",
"effective_remaining": "114.5",
"usage_pct": "42.75",
"status": "active",
"status_reason": null
}
}

セルフサービスエンドポイントは以下の機密・管理系データを返しません:

  • アカウントの累計消費 total_consumed;
  • Key の lifetime 消費 consumed.all_time;
  • モデル別消費 consumed.by_model;
  • 他の Key の一切の情報。

Management Key がこのエンドポイントを呼ぶと固定で 403 forbidden_scope を返します。

セルフサービスエンドポイントの説明

Key が手動無効化、期限切れ、額度枯渇、またはサブスクリプション有効化待ちの場合でも、自身の残高を照会でき 200 を返します。セルフサービスエンドポイントはアカウントの累計消費、Key の lifetime 消費、モデル別消費、他の Key の情報は返しません。

関連エンドポイント

共通リクエスト仕様、フィールド定義、エラーコードは 残高照会API を参照してください。

オンラインサポート