List
client.usages.list(UsageListParams { activityOffset, endDate, projectIds, 5 more } query?, RequestOptionsoptions?): UsageListResponse { activity, assetUsages, consumption, 4 more }
GET/usages
Provide usage data for the given filters. Such as consumed compute units, number of assets generated, etc. Maximum time range with custom startDate and endDate is 120 days. Granularity is calculated based on the time range.
List
import Scenario from '@scenario-labs/sdk';
const client = new Scenario({
apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});
const usages = await client.usages.list();
console.log(usages.activity);{
"activity": [
{
"action": "asset",
"data": {
"assetId": "assetId",
"byokProvider": {
"id": "id",
"displayName": "displayName"
},
"collectionId": "collectionId",
"isApiKey": true,
"jobId": "jobId",
"modelId": "modelId"
},
"projectId": "projectId",
"time": "time",
"userId": "userId",
"creativeUnitsCost": 0
}
],
"assetUsages": [
{
"kind": "3d",
"points": [
{
"count": 0,
"countApiKey": 0,
"time": "time"
}
]
}
],
"consumption": [
{
"discount": 0,
"total": 0,
"userId": "userId",
"value": 0
}
],
"entities": {
"assets": [
{
"id": "id",
"kind": "3d",
"metadata": {
"type": "3d-texture"
},
"properties": {
"size": 0,
"animationFrameCount": 0,
"bitrate": 0,
"boneCount": 0,
"channels": 0,
"classification": "effect",
"codecName": "codecName",
"description": "description",
"dimensions": [
0,
0,
0
],
"duration": 0,
"faceCount": 0,
"format": "format",
"frameRate": 0,
"hasAnimations": true,
"hasNormals": true,
"hasSkeleton": true,
"hasUVs": true,
"height": 0,
"nbFrames": 0,
"sampleRate": 0,
"transcription": {
"text": "text"
},
"vertexCount": 0,
"width": 0
},
"source": "3d23d"
}
],
"collections": [
{
"id": "id",
"name": "name"
}
],
"jobs": [
{
"id": "id",
"jobType": "assets-download",
"metadata": {
"assetIds": [
"string"
],
"error": "error",
"flow": [
{
"id": "id",
"status": "failure",
"type": "custom-model",
"assets": [
{
"assetId": "assetId",
"url": "url"
}
],
"count": 0,
"dependsOn": [
"string"
],
"includeOutputsInWorkflowJob": true,
"inputs": [
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"items": [
[
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
]
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
],
"items": [
"string"
],
"iterationIndex": 0,
"jobId": "jobId",
"logic": {
"cases": [
{
"condition": "condition",
"value": "value"
}
],
"default": "default",
"transform": "transform"
},
"logicType": "if-else",
"loopBodyNodeIds": [
"string"
],
"loopNodeId": "loopNodeId",
"modelId": "modelId",
"output": {},
"workflowId": "workflowId"
}
],
"hint": "hint",
"input": {
"foo": "bar"
},
"output": {
"foo": "bar"
},
"outputModelId": "outputModelId",
"workflowId": "workflowId",
"workflowJobId": "workflowJobId"
},
"status": "canceled"
}
],
"models": [
{
"id": "id",
"name": "name",
"shortDescription": "shortDescription"
}
],
"users": [
{
"id": "id",
"isApiKey": true,
"apiKeyId": "apiKeyId",
"apiKeyStatus": "active",
"avatar": {
"assetId": "assetId",
"url": "url"
},
"email": "email",
"fullName": "fullName"
}
]
},
"modelUsages": [
{
"modelId": "modelId",
"points": [
{
"apiKeyCost": 0,
"apiKeyDiscount": 0,
"cost": 0,
"discount": 0,
"jobs": 0,
"time": "time"
}
]
}
],
"nsfwUsages": [
{
"label": "label",
"points": [
{
"count": 0,
"countApiKey": 0,
"time": "time"
}
]
}
],
"usages": [
{
"granularity": "15m",
"points": [
{
"apiKey": "apiKey",
"time": "time",
"value": "value"
}
],
"usageName": "background-removal"
}
]
}Returns Examples
{
"activity": [
{
"action": "asset",
"data": {
"assetId": "assetId",
"byokProvider": {
"id": "id",
"displayName": "displayName"
},
"collectionId": "collectionId",
"isApiKey": true,
"jobId": "jobId",
"modelId": "modelId"
},
"projectId": "projectId",
"time": "time",
"userId": "userId",
"creativeUnitsCost": 0
}
],
"assetUsages": [
{
"kind": "3d",
"points": [
{
"count": 0,
"countApiKey": 0,
"time": "time"
}
]
}
],
"consumption": [
{
"discount": 0,
"total": 0,
"userId": "userId",
"value": 0
}
],
"entities": {
"assets": [
{
"id": "id",
"kind": "3d",
"metadata": {
"type": "3d-texture"
},
"properties": {
"size": 0,
"animationFrameCount": 0,
"bitrate": 0,
"boneCount": 0,
"channels": 0,
"classification": "effect",
"codecName": "codecName",
"description": "description",
"dimensions": [
0,
0,
0
],
"duration": 0,
"faceCount": 0,
"format": "format",
"frameRate": 0,
"hasAnimations": true,
"hasNormals": true,
"hasSkeleton": true,
"hasUVs": true,
"height": 0,
"nbFrames": 0,
"sampleRate": 0,
"transcription": {
"text": "text"
},
"vertexCount": 0,
"width": 0
},
"source": "3d23d"
}
],
"collections": [
{
"id": "id",
"name": "name"
}
],
"jobs": [
{
"id": "id",
"jobType": "assets-download",
"metadata": {
"assetIds": [
"string"
],
"error": "error",
"flow": [
{
"id": "id",
"status": "failure",
"type": "custom-model",
"assets": [
{
"assetId": "assetId",
"url": "url"
}
],
"count": 0,
"dependsOn": [
"string"
],
"includeOutputsInWorkflowJob": true,
"inputs": [
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"items": [
[
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
]
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
],
"items": [
"string"
],
"iterationIndex": 0,
"jobId": "jobId",
"logic": {
"cases": [
{
"condition": "condition",
"value": "value"
}
],
"default": "default",
"transform": "transform"
},
"logicType": "if-else",
"loopBodyNodeIds": [
"string"
],
"loopNodeId": "loopNodeId",
"modelId": "modelId",
"output": {},
"workflowId": "workflowId"
}
],
"hint": "hint",
"input": {
"foo": "bar"
},
"output": {
"foo": "bar"
},
"outputModelId": "outputModelId",
"workflowId": "workflowId",
"workflowJobId": "workflowJobId"
},
"status": "canceled"
}
],
"models": [
{
"id": "id",
"name": "name",
"shortDescription": "shortDescription"
}
],
"users": [
{
"id": "id",
"isApiKey": true,
"apiKeyId": "apiKeyId",
"apiKeyStatus": "active",
"avatar": {
"assetId": "assetId",
"url": "url"
},
"email": "email",
"fullName": "fullName"
}
]
},
"modelUsages": [
{
"modelId": "modelId",
"points": [
{
"apiKeyCost": 0,
"apiKeyDiscount": 0,
"cost": 0,
"discount": 0,
"jobs": 0,
"time": "time"
}
]
}
],
"nsfwUsages": [
{
"label": "label",
"points": [
{
"count": 0,
"countApiKey": 0,
"time": "time"
}
]
}
],
"usages": [
{
"granularity": "15m",
"points": [
{
"apiKey": "apiKey",
"time": "time",
"value": "value"
}
],
"usageName": "background-removal"
}
]
}