// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; export class Usages extends APIResource { /** * 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( query: UsageListParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/usages', { query, ...options }); } } export interface UsageListResponse { activity?: Array; assetUsages?: Array; consumption?: Array; entities?: UsageListResponse.Entities; modelUsages?: Array; nsfwUsages?: Array; slopUsages?: Array; usages?: Array; } export namespace UsageListResponse { /** * Activity entries listed in the activities results order by time DESC Default * limit of 100 entries. If you have 100 entries in your result, you can use the * activityOffset parameter to get the next page of results. We recommend you to * make the same request with type=activity only (to avoid reload everything) And * apply the activityOffset=100 to get the next page of results. Contains basic * infos about each relevant actions */ export interface Activity { /** * The action name */ action: | 'asset' | 'asset-privacy' | 'assistant-message' | 'background-removal' | 'byok-remove-project-provider' | 'byok-remove-provider' | 'byok-set-project-provider' | 'byok-set-provider' | 'captioning' | 'collection' | 'collection-assets' | 'collection-models' | 'controlnet' | 'controlnet-img2img' | 'controlnet-inpaint' | 'controlnet-ip-adapter' | 'controlnet-texture' | 'copy-asset' | 'copy-model' | 'creative-unit-cost' | 'creative-unit-discount' | 'custom' | 'custom-asset-created' | 'delete-asset' | 'delete-collection' | 'delete-collection-assets' | 'delete-collection-models' | 'delete-inference-image' | 'delete-model' | 'delete-model-preset' | 'delete-oscu-auto-refill' | 'delete-project-member' | 'delete-subscription' | 'delete-team-api-key' | 'delete-team-invitations' | 'delete-team-member' | 'delete-training-images' | 'describe-style' | 'detection' | 'disable-project-model' | 'disable-team-model' | 'download-assets' | 'download-model' | 'embed' | 'enable-project-model' | 'enable-team-model' | 'generative-fill' | 'image-prompt-editing' | 'images-generation' | 'img2img' | 'img2img-ip-adapter' | 'img2img-texture' | 'inference' | 'inpaint' | 'inpaint-ip-adapter' | 'ip-detection' | 'model' | 'model-preset' | 'models-training' | 'oscu' | 'patch' | 'pixelate' | 'project' | 'project-member' | 'reframe' | 'refunds' | 'repaint' | 'restyle' | 'segmentation' | 'skybox-base-360' | 'skybox-upscale-360' | 'start-train' | 'subscription' | 'subscription-seats' | 'tag-asset' | 'tag-model' | 'team-api-key' | 'team-member' | 'texture' | 'train-succeeded' | 'training-images-to-model' | 'transfer-model' | 'txt2img' | 'txt2img-ip-adapter' | 'update-asset' | 'update-collection' | 'update-model' | 'update-model-description' | 'update-model-examples' | 'update-model-prompt-guide' | 'update-oscu-auto-refill' | 'update-project' | 'update-project-instructions' | 'update-subscription' | 'update-team' | 'update-team-instructions' | 'update-team-member' | 'upscale' | 'vectorization'; /** * The additional data of the action */ data: Activity.Data; /** * The projectId of the project for this action */ projectId: string; /** * The UTC ISO date of the point */ time: string; /** * The unique identifier of the user for this action */ userId: string; /** * The Compute Units cost for this action */ creativeUnitsCost?: number; } export namespace Activity { /** * The additional data of the action */ export interface Data { /** * The asset for this action */ assetId?: string; /** * The BYOK provider information for this action Only set if the action is a BYOK * action (byok-set-provider or byok-remove-provider) */ byokProvider?: Data.ByokProvider; /** * The collection for this action */ collectionId?: string; /** * Whether the action is an API key action */ isApiKey?: boolean; /** * The job for this action */ jobId?: string; /** * The model for this action */ modelId?: string; } export namespace Data { /** * The BYOK provider information for this action Only set if the action is a BYOK * action (byok-set-provider or byok-remove-provider) */ export interface ByokProvider { id: string; displayName: string; } } } export interface AssetUsage { kind: '3d' | 'audio' | 'document' | 'image' | 'image-hdr' | 'json' | 'text' | 'video'; /** * The data points */ points: Array; } export namespace AssetUsage { export interface Point { /** * Number of assets created */ count: number; /** * Number of assets created via an API key */ countApiKey: number; /** * The UTC ISO date of the point */ time: string; } } /** * Consumption entries sorted in descending order by consumption value. * * There is no limit on the number of entries */ export interface Consumption { /** * The Compute Units discount for the user */ discount: number; /** * The total consumption for the user (value + discount) */ total: number; /** * The unique identifier of the user */ userId: string; /** * The Compute Units consumption for the user */ value: number; /** * Compute Units consumed per billing action, when a breakdown is available * (example: `{ "slop-detection": 12 }`). Values are included in `value`. */ costDetails?: unknown; } export interface Entities { assets?: Array; collections?: Array; jobs?: Array; models?: Array; users?: Array; } export namespace Entities { export interface Asset { /** * The asset ID */ id: string; /** * The kind of the asset */ kind: '3d' | 'audio' | 'document' | 'image' | 'image-hdr' | 'json' | 'text' | 'video'; /** * Partial metadata of the asset */ metadata: Asset.Metadata; /** * The properties of the asset */ properties: Asset.Properties; /** * The source of the asset */ source: | '3d23d' | '3d23d:texture' | '3d:texture' | '3d:texture:albedo' | '3d:texture:metallic' | '3d:texture:mtl' | '3d:texture:normal' | '3d:texture:roughness' | 'audio2audio' | 'audio2txt' | 'audio2video' | 'background-removal' | 'canvas' | 'canvas-drawing' | 'canvas-export' | 'detection' | 'generative-fill' | 'image-prompt-editing' | 'img23d' | 'img2img' | 'img2splat' | 'img2txt' | 'img2video' | 'inference-control-net' | 'inference-control-net-img' | 'inference-control-net-inpainting' | 'inference-control-net-inpainting-ip-adapter' | 'inference-control-net-ip-adapter' | 'inference-control-net-reference' | 'inference-control-net-texture' | 'inference-img' | 'inference-img-ip-adapter' | 'inference-img-texture' | 'inference-in-paint' | 'inference-in-paint-ip-adapter' | 'inference-reference' | 'inference-reference-texture' | 'inference-txt' | 'inference-txt-ip-adapter' | 'inference-txt-texture' | 'patch' | 'pixelization' | 'reframe' | 'restyle' | 'segment' | 'segmentation-image' | 'segmentation-mask' | 'skybox-3d' | 'skybox-base-360' | 'skybox-hdri' | 'texture' | 'texture:albedo' | 'texture:ao' | 'texture:edge' | 'texture:height' | 'texture:metallic' | 'texture:normal' | 'texture:smoothness' | 'txt23d' | 'txt2audio' | 'txt2img' | 'txt2txt' | 'txt2video' | 'unknown' | 'uploaded' | 'uploaded-3d' | 'uploaded-audio' | 'uploaded-avatar' | 'uploaded-text' | 'uploaded-video' | 'upscale' | 'upscale-skybox' | 'upscale-texture' | 'upscale-video' | 'vectorization' | 'video23d' | 'video2audio' | 'video2img' | 'video2video' | 'voice-clone'; } export namespace Asset { /** * Partial metadata of the asset */ export interface Metadata { /** * The type of the asset */ type: | '3d-texture' | '3d-texture-albedo' | '3d-texture-metallic' | '3d-texture-mtl' | '3d-texture-normal' | '3d-texture-roughness' | '3d23d' | '3d23d-texture' | 'audio2audio' | 'audio2txt' | 'audio2video' | 'background-removal' | 'canvas' | 'canvas-drawing' | 'canvas-export' | 'detection' | 'generative-fill' | 'image-prompt-editing' | 'img23d' | 'img2img' | 'img2splat' | 'img2txt' | 'img2video' | 'inference-controlnet' | 'inference-controlnet-img2img' | 'inference-controlnet-inpaint' | 'inference-controlnet-inpaint-ip-adapter' | 'inference-controlnet-ip-adapter' | 'inference-controlnet-reference' | 'inference-controlnet-texture' | 'inference-img2img' | 'inference-img2img-ip-adapter' | 'inference-img2img-texture' | 'inference-inpaint' | 'inference-inpaint-ip-adapter' | 'inference-reference' | 'inference-reference-texture' | 'inference-txt2img' | 'inference-txt2img-ip-adapter' | 'inference-txt2img-texture' | 'patch' | 'pixelization' | 'reframe' | 'restyle' | 'segment' | 'segmentation-image' | 'segmentation-mask' | 'skybox-3d' | 'skybox-base-360' | 'skybox-hdri' | 'texture' | 'texture-albedo' | 'texture-ao' | 'texture-edge' | 'texture-height' | 'texture-metallic' | 'texture-normal' | 'texture-smoothness' | 'txt23d' | 'txt2audio' | 'txt2img' | 'txt2txt' | 'txt2video' | 'unknown' | 'uploaded' | 'uploaded-3d' | 'uploaded-audio' | 'uploaded-avatar' | 'uploaded-text' | 'uploaded-video' | 'upscale' | 'upscale-skybox' | 'upscale-texture' | 'upscale-video' | 'vectorization' | 'video23d' | 'video2audio' | 'video2img' | 'video2video' | 'voice-clone'; } /** * The properties of the asset */ export interface Properties { size: number; /** * Number of animation frames if animations exist */ animationFrameCount?: number; /** * Bitrate of the media in bits per second */ bitrate?: number; /** * Number of bones if skeleton exists */ boneCount?: number; /** * Recommended preview camera mode emitted by the generator (gsplat route); passed * through to mesh-rendering verbatim. */ cameraMode?: 'aerial' | 'interior' | 'turntable'; /** * Recommended preview camera path emitted by the generator (gsplat route); passed * through to mesh-rendering verbatim. */ cameraTrajectory?: Array; /** * Number of channels of the audio */ channels?: number; /** * Number of Unicode code points in the text. Code-point-aware (so a non-BMP emoji * counts as 1) but not full grapheme-cluster aware (a ZWJ sequence still counts as * several). */ charCount?: number; /** * Classification of the audio */ classification?: 'effect' | 'interview' | 'music' | 'other' | 'sound' | 'speech' | 'text' | 'unknown'; /** * Codec name of the media */ codecName?: string; /** * Description of the audio */ description?: string; /** * Bounding box dimensions [width, height, depth] */ dimensions?: Array; /** * Duration of the media in seconds */ duration?: number; /** * Number of faces/triangles in the mesh */ faceCount?: number; /** * Format of the mesh file (e.g. 'glb', etc.) */ format?: string; /** * Frame rate of the video in frames per second */ frameRate?: number; /** * Whether the mesh has animations */ hasAnimations?: boolean; /** * True when `preview` holds the entire content unmodified — consumers can use it * directly without fetching `asset.url`. False or undefined means the content * exceeds the preview budget and consumers must fetch the full body from S3 to * read past the preview. */ hasFullPreview?: boolean; /** * Whether the mesh has normal vectors */ hasNormals?: boolean; /** * Whether the mesh has bones/skeleton */ hasSkeleton?: boolean; /** * Whether the mesh has UV coordinates */ hasUVs?: boolean; height?: number; /** * Number of frames in the video */ nbFrames?: number; /** * Leading slice of the content used for inline UI display and as a search * shortcut. Capped at TEXT_PREVIEW_MAX_BYTES (UTF-8) and always cut on a * code-point boundary so no character is split. Number of characters in the * preview varies by script (around 1024 for ASCII, ~340 for CJK, ~256 for * emoji-heavy text at the default 1 KB budget). */ preview?: string; /** * Sample rate of the media in Hz */ sampleRate?: number; /** * Transcription of the audio */ transcription?: Properties.Transcription; /** * Number of vertices in the mesh */ vertexCount?: number; width?: number; /** * Number of whitespace-separated words in the text */ wordCount?: number; } export namespace Properties { /** * One explicit camera keyframe for the splat route. Several are interpolated over * the requested frames into an orbit/fly-through; a single keyframe renders a * static view. Overrides {@link SplatCameraMode} when provided. */ export interface CameraTrajectory { /** * Camera eye position in the splat's world frame. */ position: Array; /** * Look-at point in the splat's world frame. */ target: Array; /** * Vertical field of view in degrees (defaults to 50 in the renderer). */ fov?: number; } /** * Transcription of the audio */ export interface Transcription { text: string; } } } export interface Collection { /** * The collection ID */ id: string; /** * The name of the collection */ name: string; } export interface Job { /** * The job ID */ id: string; /** * The job type */ jobType: | 'assets-download' | 'canvas-export' | 'caption' | 'caption-llava' | 'custom' | 'describe-style' | 'detection' | 'embed' | 'flux' | 'flux-model-training' | 'generate-prompt' | 'image-generation' | 'image-prompt-editing' | 'inference' | 'mesh-preview-rendering' | 'model-download' | 'model-import' | 'model-training' | 'musubi-model-training' | 'openai-image-generation' | 'patch-image' | 'pixelate' | 'reframe' | 'remove-background' | 'repaint' | 'restyle' | 'segment' | 'skybox-3d' | 'skybox-base-360' | 'skybox-hdri' | 'skybox-upscale-360' | 'splat' | 'texture' | 'translate' | 'upload' | 'upscale' | 'upscale-skybox' | 'upscale-texture' | 'vectorize' | 'workflow'; /** * The metadata of the job */ metadata: Job.Metadata; /** * The status of the job */ status: | 'canceled' | 'failure' | 'finalizing' | 'in-progress' | 'pending' | 'queued' | 'success' | 'warming-up'; } export namespace Job { /** * The metadata of the job */ export interface Metadata { /** * List of produced assets for this job */ assetIds?: Array; /** * Eventual error for the job */ error?: string | null; /** * The flow of the job. Only available for workflow jobs. */ flow?: Array; /** * Actionable hint for the user explaining what went wrong and how to resolve it. */ hint?: string; /** * The inputs for the job */ input?: { [key: string]: unknown }; /** * May contain the output of the job for specific custom models jobs. Only * available for custom models which generate non-assets outputs. Example: LLM text * results. */ output?: { [key: string]: unknown }; /** * For voice-clone jobs: the ID of the model being trained. */ outputModelId?: string; /** * The workflow ID of the job if job is part of a workflow. */ workflowId?: string; /** * The workflow job ID of the job if job is part of a workflow job. */ workflowJobId?: string; } export namespace Metadata { export interface Flow { /** * The id of the node. */ id: string; /** * The status of the node. Only available for WorkflowJob nodes. */ status: 'failure' | 'pending' | 'processing' | 'rejected' | 'skipped' | 'success'; /** * The type of the job for the node. */ type: | 'custom-model' | 'for-each' | 'generate-prompt' | 'list' | 'logic' | 'model' | 'remove-background' | 'transform' | 'user-approval' | 'workflow'; /** * List of produced assets for this node. */ assets?: Array; /** * Fixed number of iterations for a ForEach node. When set, the loop runs exactly * `count` times regardless of array input. When not set, the loop iterates over * the resolved array input. Only available for ForEach nodes. */ count?: number; /** * The nodes that this node depends on. Only available for nodes that have * dependencies. Mainly used for user approval nodes. */ dependsOn?: Array; /** * If true, the outputs of this node will be included in the workflow job's final * output. Only applicable to producing nodes (custom-model, inference, etc.). By * default, only last nodes (nodes not referenced by other nodes) contribute to * outputs. Set this to true to also include intermediate nodes in the final * output. Note: This should only be set to `true` or left undefined. */ includeOutputsInWorkflowJob?: true; /** * The inputs of the node. */ inputs?: Array; /** * Statically-configured items for a List node. The node outputs this array as-is * when executed. Only available for List nodes. The values can be strings, * numbers, or asset IDs. */ items?: Array; /** * Zero-based index of the iteration this node copy belongs to. Set on * dynamically-created copies of loop body nodes. */ iterationIndex?: number; /** * If the flow is part of a WorkflowJob, this is the jobId for the node. jobId is * only available for nodes started. A node "Pending" for a running workflow job is * not started. */ jobId?: string; /** * The logic of the node. Only available for logic nodes. */ logic?: Flow.Logic; /** * The type of the logic for the node. Only available for logic nodes. */ logicType?: 'if-else'; /** * IDs of the body template nodes that belong to this ForEach loop. At runtime * these templates are cloned once per iteration and marked Skipped. Only available * for ForEach nodes. */ loopBodyNodeIds?: Array; /** * ID of the ForEach node that spawned this iteration copy. Set on * dynamically-created copies of loop body nodes. */ loopNodeId?: string; /** * The model id for the node. Mainly used for custom model tasks. */ modelId?: string; /** * The output of the node. Only available for logic nodes. */ output?: unknown; /** * The workflow id for the node. Mainly used for workflow tasks. */ workflowId?: string; } export namespace Flow { export interface Asset { assetId: string; url: string; } /** * This is used to run the flow. */ export interface Input { /** * The name that must be user to call the model through the API */ name: string; /** * The data type of the input */ type: | 'boolean' | 'file' | 'file_array' | 'inputs_array' | 'model' | 'model_array' | 'number' | 'number_array' | 'string' | 'string_array'; /** * The allowed values for the input. For \`string\` or \`number\` types, creates a * single-select dropdown. For \`string_array\` type, creates a multi-select * dropdown. */ allowedValues?: Array; /** * Specifies the background behavior for the input. Only available for \`file\` and * \`file_array\` input types with kind \`image\`. */ backgroundBehavior?: 'opaque' | 'transparent'; /** * Whether the input is a color or not. Only available for \`string\` input type. */ color?: boolean; /** * Whether this input affects the model's cost calculation */ costImpact?: boolean; /** * The default value for the input */ default?: unknown; /** * Help text displayed in the UI to provide additional information about the input */ description?: string; /** * Used to visually group inputs together in the UI. Inputs with the same group * value appear consecutively in the UI. */ group?: string; /** * Hint text displayed in the UI as a tooltip to guide the user */ hint?: string; /** * The list of inputs which form an object within a container array. All inputs are * the same as the current object. This is only available for type inputs_array * inputs. */ inputs?: Array<{ [key: string]: unknown }>; /** * The configured items for inputs_array type inputs. Each item is an array of * SubNodeInput that need ref/value resolution. Only available for inputs_array * type. */ items?: Array>; /** * The asset kind of the input. Only taken into account for \`file\` and * \`file_array\` input types. If model provides multiple kinds, the input will be * not able to create the asset on the flight on API side with dataurl without * data:kind, prefix */ kind?: '3d' | 'audio' | 'document' | 'image' | 'image-hdr' | 'json' | 'text' | 'video'; /** * The label displayed in the UI for this input */ label?: string; /** * The name of the file input field to use as the mask source */ maskFrom?: string; /** * The maximum allowed value. Only available for \`number\` and \`array\` input * types. */ max?: number; /** * The maximum allowed media duration in seconds. Only applies to \`file\` and * \`file_array\` input types for video and audio assets. Validated against * \`asset.properties.duration\` at job creation time. */ maxDuration?: number; /** * The maximum allowed length for \`string\` inputs. Also applies to each item in * \`string_array\`. */ maxLength?: number; /** * The maximum allowed file size in bytes. Only applies to \`file\` and * \`file_array\` input types. Validated against \`asset.properties.size\` at job * creation time. */ maxSize?: number; /** * The minimum allowed value. Only available for \`number\` and array input types. */ min?: number; /** * The minimum allowed length for string inputs. Also applies to each item in * \`string_array\`. */ minLength?: number; /** * The allowed model types for this input. Example: \`["flux.1-lora"]\`. Only * available for \`model_array\` input type. */ modelTypes?: Array< | 'custom' | 'elevenlabs-voice' | 'flux.1' | 'flux.1-composition' | 'flux.1-kontext-dev' | 'flux.1-kontext-lora' | 'flux.1-krea-dev' | 'flux.1-krea-lora' | 'flux.1-lora' | 'flux.1-pro' | 'flux.1.1-pro-ultra' | 'flux.2-dev-edit-lora' | 'flux.2-dev-lora' | 'flux.2-klein-4b-edit-lora' | 'flux.2-klein-4b-lora' | 'flux.2-klein-9b-edit-lora' | 'flux.2-klein-9b-lora' | 'flux.2-klein-base-4b-edit-lora' | 'flux.2-klein-base-4b-lora' | 'flux.2-klein-base-9b-edit-lora' | 'flux.2-klein-base-9b-lora' | 'flux1.1-pro' | 'gpt-image-1' | 'qwen-image-2512-lora' | 'qwen-image-edit-2509-lora' | 'qwen-image-edit-2511-lora' | 'qwen-image-edit-lora' | 'qwen-image-lora' | 'zimage-de-turbo-lora' | 'zimage-lora' | 'zimage-turbo-lora' >; /** * Whether this input represents a parent asset to assign to the produced assets. * Only available for \`file\` and \`file_array\` input types. * * For \`file_array\`, the parent asset is the first item in the array. */ parent?: boolean; /** * Placeholder text for the input. Only available for 'string' input type. */ placeholder?: string; /** * Whether the input is a prompt. When true, displays as a text area with prompt * spark feature. Only available for \`string\` input type. */ prompt?: boolean; /** * Whether the input is used with prompt spark. Only available for \`string\` input * type. */ promptSpark?: boolean; /** * The reference to another input or output of the same workflow. Must have at * least one of node or conditional. */ ref?: Input.Ref; /** * Set of rules that describes when this input is required: * * - \`always\`: Input is always required * - \`ifNotDefined\`: Input is required when another specified input is not * defined * - \`ifDefined\`: Input is required when another specified input is defined * - \`conditionalValues\`: Input is required when another input has a specific * value * * By default, the input is not required. */ required?: Input.Required; /** * The step increment for numeric inputs. Only available for \`number\` input type. */ step?: number; /** * The value of the input. This is the value of the input that will be used to run * the node. Only available for flows managed by a WorkflowJob. */ value?: unknown; } export namespace Input { /** * A sub-input within an inputs_array item. Same as NodeInput but without the * recursive items field. */ export interface Item { /** * The name that must be user to call the model through the API */ name: string; /** * The data type of the input */ type: | 'boolean' | 'file' | 'file_array' | 'inputs_array' | 'model' | 'model_array' | 'number' | 'number_array' | 'string' | 'string_array'; /** * The allowed values for the input. For \`string\` or \`number\` types, creates a * single-select dropdown. For \`string_array\` type, creates a multi-select * dropdown. */ allowedValues?: Array; /** * Specifies the background behavior for the input. Only available for \`file\` and * \`file_array\` input types with kind \`image\`. */ backgroundBehavior?: 'opaque' | 'transparent'; /** * Whether the input is a color or not. Only available for \`string\` input type. */ color?: boolean; /** * Whether this input affects the model's cost calculation */ costImpact?: boolean; /** * The default value for the input */ default?: unknown; /** * Help text displayed in the UI to provide additional information about the input */ description?: string; /** * Used to visually group inputs together in the UI. Inputs with the same group * value appear consecutively in the UI. */ group?: string; /** * Hint text displayed in the UI as a tooltip to guide the user */ hint?: string; /** * The list of inputs which form an object within a container array. All inputs are * the same as the current object. This is only available for type inputs_array * inputs. */ inputs?: Array<{ [key: string]: unknown }>; /** * The asset kind of the input. Only taken into account for \`file\` and * \`file_array\` input types. If model provides multiple kinds, the input will be * not able to create the asset on the flight on API side with dataurl without * data:kind, prefix */ kind?: '3d' | 'audio' | 'document' | 'image' | 'image-hdr' | 'json' | 'text' | 'video'; /** * The label displayed in the UI for this input */ label?: string; /** * The name of the file input field to use as the mask source */ maskFrom?: string; /** * The maximum allowed value. Only available for \`number\` and \`array\` input * types. */ max?: number; /** * The maximum allowed media duration in seconds. Only applies to \`file\` and * \`file_array\` input types for video and audio assets. Validated against * \`asset.properties.duration\` at job creation time. */ maxDuration?: number; /** * The maximum allowed length for \`string\` inputs. Also applies to each item in * \`string_array\`. */ maxLength?: number; /** * The maximum allowed file size in bytes. Only applies to \`file\` and * \`file_array\` input types. Validated against \`asset.properties.size\` at job * creation time. */ maxSize?: number; /** * The minimum allowed value. Only available for \`number\` and array input types. */ min?: number; /** * The minimum allowed length for string inputs. Also applies to each item in * \`string_array\`. */ minLength?: number; /** * The allowed model types for this input. Example: \`["flux.1-lora"]\`. Only * available for \`model_array\` input type. */ modelTypes?: Array< | 'custom' | 'elevenlabs-voice' | 'flux.1' | 'flux.1-composition' | 'flux.1-kontext-dev' | 'flux.1-kontext-lora' | 'flux.1-krea-dev' | 'flux.1-krea-lora' | 'flux.1-lora' | 'flux.1-pro' | 'flux.1.1-pro-ultra' | 'flux.2-dev-edit-lora' | 'flux.2-dev-lora' | 'flux.2-klein-4b-edit-lora' | 'flux.2-klein-4b-lora' | 'flux.2-klein-9b-edit-lora' | 'flux.2-klein-9b-lora' | 'flux.2-klein-base-4b-edit-lora' | 'flux.2-klein-base-4b-lora' | 'flux.2-klein-base-9b-edit-lora' | 'flux.2-klein-base-9b-lora' | 'flux1.1-pro' | 'gpt-image-1' | 'qwen-image-2512-lora' | 'qwen-image-edit-2509-lora' | 'qwen-image-edit-2511-lora' | 'qwen-image-edit-lora' | 'qwen-image-lora' | 'zimage-de-turbo-lora' | 'zimage-lora' | 'zimage-turbo-lora' >; /** * Whether this input represents a parent asset to assign to the produced assets. * Only available for \`file\` and \`file_array\` input types. * * For \`file_array\`, the parent asset is the first item in the array. */ parent?: boolean; /** * Placeholder text for the input. Only available for 'string' input type. */ placeholder?: string; /** * Whether the input is a prompt. When true, displays as a text area with prompt * spark feature. Only available for \`string\` input type. */ prompt?: boolean; /** * Whether the input is used with prompt spark. Only available for \`string\` input * type. */ promptSpark?: boolean; /** * The reference to another input or output of the same workflow. Must have at * least one of node or conditional. */ ref?: Item.Ref; /** * Set of rules that describes when this input is required: * * - \`always\`: Input is always required * - \`ifNotDefined\`: Input is required when another specified input is not * defined * - \`ifDefined\`: Input is required when another specified input is defined * - \`conditionalValues\`: Input is required when another input has a specific * value * * By default, the input is not required. */ required?: Item.Required; /** * The step increment for numeric inputs. Only available for \`number\` input type. */ step?: number; /** * The value of the input. This is the value of the input that will be used to run * the node. Only available for flows managed by a WorkflowJob. */ value?: unknown; } export namespace Item { /** * The reference to another input or output of the same workflow. Must have at * least one of node or conditional. */ export interface Ref { /** * The conditional nodes to reference. If the conditional nodes are successful, the * node will be successful. If the conditional nodes are skipped, the node will be * skipped. Contains an array of node ids used to check the status of the nodes. */ conditional?: Array; /** * This is the desired node output value if ref is an if/else node. */ equal?: string; /** * The name of the input or output to reference. If the type is 'workflow', the * name is the name of the input of the workflow is required If the type is 'node', * the name is not mandatory, except if you want all outputs of the node. To get * all outputs of a node, you can use the name 'all'. */ name?: string; /** * The node id or 'workflow' if the source is a workflow input. */ node?: string; } /** * Set of rules that describes when this input is required: * * - \`always\`: Input is always required * - \`ifNotDefined\`: Input is required when another specified input is not * defined * - \`ifDefined\`: Input is required when another specified input is defined * - \`conditionalValues\`: Input is required when another input has a specific * value * * By default, the input is not required. */ export interface Required { /** * Whether the input is always required */ always?: boolean; /** * Makes this input required when another input has a specific value: * * - Key: name of the input to check * - Value: operation and allowed values that trigger the requirement */ conditionalValues?: unknown; /** * Makes this input required when another input is defined: * * - Key: name of the input that must be defined * - Value: message to display when this input is required */ ifDefined?: unknown; /** * Makes this input required when another input is not defined: * * - Key: name of the input that must be undefined * - Value: message to display when this input is required */ ifNotDefined?: unknown; } } /** * The reference to another input or output of the same workflow. Must have at * least one of node or conditional. */ export interface Ref { /** * The conditional nodes to reference. If the conditional nodes are successful, the * node will be successful. If the conditional nodes are skipped, the node will be * skipped. Contains an array of node ids used to check the status of the nodes. */ conditional?: Array; /** * This is the desired node output value if ref is an if/else node. */ equal?: string; /** * The name of the input or output to reference. If the type is 'workflow', the * name is the name of the input of the workflow is required If the type is 'node', * the name is not mandatory, except if you want all outputs of the node. To get * all outputs of a node, you can use the name 'all'. */ name?: string; /** * The node id or 'workflow' if the source is a workflow input. */ node?: string; } /** * Set of rules that describes when this input is required: * * - \`always\`: Input is always required * - \`ifNotDefined\`: Input is required when another specified input is not * defined * - \`ifDefined\`: Input is required when another specified input is defined * - \`conditionalValues\`: Input is required when another input has a specific * value * * By default, the input is not required. */ export interface Required { /** * Whether the input is always required */ always?: boolean; /** * Makes this input required when another input has a specific value: * * - Key: name of the input to check * - Value: operation and allowed values that trigger the requirement */ conditionalValues?: unknown; /** * Makes this input required when another input is defined: * * - Key: name of the input that must be defined * - Value: message to display when this input is required */ ifDefined?: unknown; /** * Makes this input required when another input is not defined: * * - Key: name of the input that must be undefined * - Value: message to display when this input is required */ ifNotDefined?: unknown; } } /** * The logic of the node. Only available for logic nodes. */ export interface Logic { /** * The cases of the logic. Only available for if/else nodes. */ cases?: Array; /** * The default case of the logic. Contains the id/output of the node to execute if * no case is matched. Only available for if/else nodes. */ default?: string; /** * The transform of the logic. Only available for transform nodes. */ transform?: string; } export namespace Logic { export interface Case { condition: string; value: string; } } } } } export interface Model { /** * The model ID */ id: string; /** * The name of the model */ name: string; /** * The short description of the model */ shortDescription?: string; } export interface User { /** * The user ID */ id: string; /** * Whether the user is an API key */ isApiKey: boolean; /** * The API key ID * * Will be available: * * - if the user is an API key */ apiKeyId?: string; /** * The API key status * * Will be available: * * - if the user is an API key */ apiKeyStatus?: 'active' | 'deleted' | 'inactive'; /** * The user avatar * * Will be available: * * - if the user hasn't left the Scenario platform * - if the user isn't an API key */ avatar?: User.Avatar; /** * The email of the user * * Will be available: * * - if the user hasn't left the Scenario platform * - if the user isn't an API key */ email?: string; /** * The full name of the user * * Will be available: * * - if the user hasn't left the Scenario platform * - if the user isn't an API key */ fullName?: string; } export namespace User { /** * The user avatar * * Will be available: * * - if the user hasn't left the Scenario platform * - if the user isn't an API key */ export interface Avatar { /** * ID of the asset used as thumbnail if provided, otherwise undefined */ assetId?: string; /** * Signed URL of the assetId or free url if assetId is undefined */ url?: string; } } } export interface ModelUsage { modelId: string; /** * The data points */ points: Array; } export namespace ModelUsage { export interface Point { /** * Cost for model usage for API key only */ apiKeyCost: number; /** * The discount for model usage for API key only */ apiKeyDiscount: number; /** * Cost for model usage */ cost: number; /** * The discount for model usage */ discount: number; /** * Number of jobs for the model usage */ jobs: number; /** * The UTC ISO date of the point */ time: string; } } export interface NsfwUsage { label: string; /** * The data points */ points: Array; } export namespace NsfwUsage { export interface Point { /** * Number of NSFW assets created */ count: number; /** * Number of NSFW assets created via an API key */ countApiKey: number; /** * The UTC ISO date of the point */ time: string; } } /** * A SlopGuard verdict series: one per bucket (total | pass | warn | fail). */ export interface SlopUsage { /** * The data points */ points: Array; /** * The verdict bucket: "total", "pass", "warn", or "fail" */ verdict: string; } export namespace SlopUsage { /** * One time-bucket point in a SlopGuard verdict series. */ export interface Point { /** * Distinct scored assets in this bucket for this verdict */ count: number; /** * Of `count`, the number of assets generated via an API key. */ countApiKey: number; /** * The UTC ISO date of the point */ time: string; } } export interface Usage { /** * Granularity for points (example: "1d", "1h", "1m", "15m") */ granularity: '15m' | '1d' | '1h' | '1m' | '30m' | '5m' | '7d'; /** * The usage data points */ points: Array; /** * Name of the usage points (example: "images-generation", "generators-training", * "background-removal", "upscale", ...) */ usageName: | 'background-removal' | 'captioning' | 'creative-unit-cost' | 'creative-unit-discount' | 'custom' | 'custom-asset-created' | 'detection' | 'image-prompt-editing' | 'images-generation' | 'ip-detection' | 'models-training' | 'patch' | 'pixelate' | 'refunds' | 'repaint' | 'restyle' | 'segmentation' | 'skybox-base-360' | 'skybox-upscale-360' | 'texture' | 'upscale' | 'vectorization'; } export namespace Usage { export interface Point { /** * Value of the point for API key only */ apiKey: string; /** * The UTC ISO date of the point */ time: string; /** * Value of the point */ value: string; /** * Cost in Compute Units for the point restricted to API-key calls (mirrors the * `apiKey` value field but on the cost axis). */ apiKeyCost?: number; /** * Discount in Compute Units for the point restricted to API-key calls. */ apiKeyDiscount?: number; /** * Cost in Compute Units for the point. Only populated for usage actions that carry * a CU cost (generations, trainings, etc.). Free actions like `delete-asset` or * `tag-asset` will report `0`. */ cost?: number; /** * Discount applied in Compute Units for the point. Only populated for usage * actions that carry a CU discount. */ discount?: number; } } } export interface UsageListParams { /** * The offset for the activity data. Default is 0. If bad offset or empty, 0 will * be returned. Must be a positive integer. */ activityOffset?: number; /** * When set, points whose numeric fields are all zero are removed from `usages`, * `modelUsages`, `assetUsages`, `nsfwUsages` and `slopUsages`. The parent entry * (model, kind, label, usageName) is preserved with `points: []` so callers still * see every row. Useful on wide windows × fine granularities × many models, where * the zero-fill can push the response past the 6 MB API Gateway sync limit. The * bare `?dropZeroPoints` form, plus any value (`true`, `1`, `yes`, `on`, …) * enables it; absent or explicit falsy literals (`false`, `0`, `no`, `off`) * disable it. Default disabled for backwards compatibility. */ dropZeroPoints?: boolean; /** * The end date of the usage in ISO 8601 format. If not provided, use default * timeRange. If provided, startDate is required. */ endDate?: string; /** * The project ids for filtering the usage data. If not provided, use all projects. * Can be one or more comma separated values. */ projectIds?: string; /** * The start date of the usage in ISO 8601 format. If not provided, use default * timeRange. If provided, endDate is required. */ startDate?: string; /** * The teamId used for ownership resource management. Either to assert ownership or * to set the owner of the resource(s) */ teamId?: string; /** * The time range of the usage. If not provided, use default timeRange. If * startDate and endDate provided, timeRange is ignored. */ timeRange?: 'last-hour' | 'last-day' | 'last-three-days' | 'last-seven-days' | 'last-thirty-one-days'; /** * The type of the usage data. Can be one or more comma separated values. Can be * any of the following values: usages, activity, consumption, model-usages, * asset-usages, nsfw-usages, slop-usages. Default is all types. If bad type or * empty, all types will be returned. */ type?: Array< 'usages' | 'activity' | 'consumption' | 'model-usages' | 'asset-usages' | 'nsfw-usages' | 'slop-usages' >; /** * The unique identifier of the user for the usage. If not provided, returns all * usages for the team. */ userId?: string; /** * The unique identifiers of the users for filtering the usage data. If not * provided, use all users. Can be one or more comma separated values. */ userIds?: string; } export declare namespace Usages { export { type UsageListResponse as UsageListResponse, type UsageListParams as UsageListParams }; }