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

Documentation Index

Fetch the complete documentation index at: https://docs.qoder.com/llms.txt

Use this file to discover all available pages before exploring further.

このドキュメントについて

Credits の利用イベントとサマリーをメンバーまたは組織単位で取得します。事前に API キーの取得 を完了し、共通仕様 を参照してください。

前提条件

  • 対象組織に紐づく有効な API キー。

API 一覧

1. 使用量イベント一覧

GET /v1/organizations/{organization_id}/members/{member_id}/usage-events 指定メンバーの集計済み Credits 使用量レコードをページネーションで取得します。

パスパラメータ

パラメータ必須説明
organization_idstringはい組織 ID
member_idstringはいメンバー ID

クエリパラメータ

パラメータ必須説明
startDatestringいいえ開始時間;RFC 3339 形式または Unix ミリ秒タイムスタンプ
endDatestringいいえ終了時間;RFC 3339 形式または Unix ミリ秒タイムスタンプ
sourcesstringいいえソースでフィルタ、カンマ区切り。値:IDECLIJetBrains PluginWebQoderWork
operationsstringいいえ操作でフィルタ、カンマ区切り。値:Inline ChatAskAgentRepo WikiQuestPlan ModeCode ReviewOptimize InputVoice InputExpertsImage
modelTiersstringいいえモデルティアでフィルタ、カンマ区切り。値:AutoPerformanceEfficientLiteUltimateVisionQwen-Coder-Qoder-1.0Kimi-K2.5GLM-5MiniMax-M2.5DeepSeek-V4.0Qwen3.5-PlusStandardPremiumEnterprise
maxResultsintegerいいえページサイズ(デフォルト 20、最大 100)
nextCreditsstringいいえページネーションカーソル

成功レスポンス(200 OK)

使用量レコードあり、次ページあり:
{
  "usages": [
    {
      "timestamp": 1719849600000,
      "userId": "user_abc123",
      "userEmail": "user@example.com",
      "source": "IDE",
      "operation": "Agent",
      "modelTier": "Ultimate",
      "credits": 0.35,
      "cost": 0.35
    },
    {
      "timestamp": 1719849500000,
      "userId": "user_abc123",
      "source": "CLI",
      "operation": "Completion",
      "credits": 0.02,
      "cost": 0.02
    }
  ],
  "maxResults": 20,
  "nextCredits": "eyJwYWdlIjogMn0="
}
一部のレコードでは userEmailmodelTier返されない場合があります。インテグレーション時はオプションフィールドとして処理してください。
使用量レコードなし / 最終ページ:
{

  "usages": [],

  "maxResults": 20
}
nextCredits が空または存在しない場合は最終ページです。

レスポンスフィールド

フィールド説明
usagesarray使用量レコードリスト
usages[].timestampint64開始時間(Unix ミリ秒タイムスタンプ)
usages[].userIdstringユーザー ID
usages[].userEmailstringユーザーメール(空の場合あり)
usages[].sourcestringソース:IDECLIJetBrains PluginWebQoderWork
usages[].operationstring操作:Inline ChatAskAgentRepo WikiQuestPlan ModeCode ReviewOptimize InputVoice InputExpertsImage
usages[].modelTierstringモデルティア(空の場合あり):AutoPerformanceEfficientLiteUltimateVisionQwen-Coder-Qoder-1.0Kimi-K2.5GLM-5MiniMax-M2.5DeepSeek-V4.0Qwen3.5-PlusStandardPremiumEnterprise
usages[].creditsfloat64消費 Credits(小数点以下2桁)
usages[].costfloat64課金換算後のコスト(小数点以下2桁);通常 credits と同額または固定換算比率
maxResultsint32このリクエストのページサイズ
nextCreditsstring次ページカーソル;空は最終ページ

2. 使用量サマリー取得

GET /v1/organizations/{organization_id}/members/{member_id}/usage-summary 指定された期間内のメンバーの Credits 消費を指定ディメンションで集計します。期間は 7 日以内でなければなりません。

パスパラメータ

パラメータ必須説明
organization_idstringはい組織 ID
member_idstringはいメンバー ID

クエリパラメータ

パラメータ必須説明
startDatestringはい開始時間;RFC 3339 形式または Unix ミリ秒タイムスタンプ
endDatestringはい終了時間;RFC 3339 形式または Unix ミリ秒タイムスタンプ
groupBystringはいグループ化ディメンション:source(ソース別)または operation(操作別)

成功レスポンス(200 OK)

ソース別集計(**groupBy=source**):
{
  "summary": {
    "IDE": 12.50,
    "CLI": 3.25
  }
}
操作別集計(**groupBy=operation**):
{
  "summary": {
    "Agent": 8.40,
    "Completion": 5.10,
    "Inline Chat": 2.25
  }
}
使用量データなし:
{
  "summary": {}
}

レスポンスフィールド

フィールド説明
summaryobject集計結果;キーはグループ名(ソースまたは操作)、値は合計 Credits
summary.{key}float64そのグループの合計 Credits 消費(小数点以下2桁)

エラーレスポンス

必須パラメータ欠落(400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "startDate is required"
}
期間超過(400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "date range must not exceed 7 days"
}
無効な groupBy(400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "groupBy is required and must be 'source' or 'operation'"
}

3. 組織使用量イベント一覧

GET /v1/organizations/{organization_id}/usage-events 指定組織の全メンバーの集計済みトークン使用量レコードをページネーションで取得します。レスポンス構造はメンバー使用量イベント API と同一です。

パスパラメータ

パラメータ必須説明
organization_idstringはい組織 ID

クエリパラメータ

パラメータ必須説明
startDatestringいいえ開始時間;RFC 3339 形式または Unix ミリ秒タイムスタンプ
endDatestringいいえ終了時間;RFC 3339 形式または Unix ミリ秒タイムスタンプ
sourcesstringいいえソースでフィルタ、カンマ区切り。値:IDECLIJetBrains PluginWebQoderWork
operationsstringいいえ操作でフィルタ、カンマ区切り。値:Inline ChatAskAgentRepo WikiQuestPlan ModeCode ReviewOptimize InputVoice InputExperts
modelTiersstringいいえモデルティアでフィルタ、カンマ区切り。値:AutoPerformanceEfficientLiteUltimateVisionQwen-Coder-Qoder-1.0Kimi-K2.5GLM-5MiniMax-M2.5DeepSeek-V4.0Qwen3.5-PlusStandardPremiumEnterprise
maxResultsintegerいいえページサイズ(デフォルト 20、最大 100)
nextTokenstringいいえページネーションカーソル

成功レスポンス(200 OK)

{
  "usages": [
    {
      "timestamp": 1719849600000,
      "userId": "user_abc123",
      "userEmail": "user@example.com",
      "source": "IDE",
      "operation": "Agent",
      "modelTier": "Ultimate",
      "credits": 0.35,
      "cost": 0.35
    },
    {
      "timestamp": 1719849500000,
      "userId": "user_def456",
      "source": "CLI",
      "operation": "Ask",
      "credits": -0.02,
      "cost": -0.02
    }
  ],
  "maxResults": 20,
  "nextToken": "eyJwYWdlIjogMn0="
}
一部のレコードでは userEmailmodelTier返されない場合があります。デフォルトではメンバー使用量イベント API と同じ動作をし、正の Credits レコードのみをフィルタしません。返金や修正などの負の値のレコードも返される場合があります。

レスポンスフィールド

レスポンスフィールドの定義は「1. 使用量イベント一覧」と同一です。

使用例

メンバー使用量イベント一覧

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-events?maxResults=20" \
  -H "Authorization: Bearer <api_key>"

日付範囲でフィルタ

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-events?startDate=2025-06-01T00:00:00Z&endDate=2025-06-30T23:59:59Z" \
  -H "Authorization: Bearer <api_key>"

組織使用量イベント一覧

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/usage-events?maxResults=20" \
  -H "Authorization: Bearer <api_key>"

ソースと操作でフィルタ

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-events?sources=IDE&operations=Ask,Agent" \
  -H "Authorization: Bearer <api_key>"

ソース別使用量サマリー

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-summary?startDate=2026-03-13T00:00:00Z&endDate=2026-03-20T00:00:00Z&groupBy=source" \
  -H "Authorization: Bearer <api_key>"

操作別使用量サマリー

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-summary?startDate=2026-03-13T00:00:00Z&endDate=2026-03-20T00:00:00Z&groupBy=operation" \
  -H "Authorization: Bearer <api_key>"

エラーコード

エラーコードHTTP ステータス説明
BadRequest400リクエストパラメータが無効(例:member_id が空、日付形式が不正、期間超過、groupBy が無効)
Unauthorized401API キーが欠落または無効
Forbidden403この組織へのアクセス権限なし
NotFound404メンバーが見つからない
InternalError500サーバー内部エラー
エラーレスポンスの形式は 共通仕様エラーレスポンス を参照してください。