diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f371a10..898c725 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.13.2" + ".": "4.14.0" } diff --git a/.stats.yml b/.stats.yml index adad5ff..53d280f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 59 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml/runwayml-b9f8776472c5558535b3c872d339d7a597c81666450a9c9f5e617cb2ab937c35.yml -openapi_spec_hash: 1e2e114b299226837005450ec47aef7f -config_hash: 95e64e640428abd4184a48762d9fd5f8 +configured_endpoints: 63 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml/runwayml-61ede23e7f824f2713cf355317945b22af4ce8c00e247dff73695506569b7f09.yml +openapi_spec_hash: 377f276334721ace39ca5f97395bb336 +config_hash: 8bd51a43d85b7a841080e78e6f673b63 diff --git a/CHANGELOG.md b/CHANGELOG.md index e4e3e29..dc45ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.14.0 (2026-08-07) + +Full Changelog: [v4.13.2...v4.14.0](https://github.com/runwayml/sdk-node/compare/v4.13.2...v4.14.0) + +### Features + +* **api:** api update ([fc9fbdf](https://github.com/runwayml/sdk-node/commit/fc9fbdf3757789176250a597021e96d60e943bfe)) +* **api:** manual updates ([329e6cc](https://github.com/runwayml/sdk-node/commit/329e6cc1b562daa715d93f8845bc3d1b9d51723c)) + ## 4.13.2 (2026-07-30) Full Changelog: [v4.13.1...v4.13.2](https://github.com/runwayml/sdk-node/compare/v4.13.1...v4.13.2) diff --git a/MIGRATION.md b/MIGRATION.md index dff845b..8acd5cc 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -55,6 +55,7 @@ This affects the following methods: - `client.routers.update()` - `client.organization.retrieveUsage()` +- `client.organization.webapp.auditLogs.retrieve()` - `client.avatars.update()` - `client.documents.update()` - `client.voices.update()` diff --git a/api.md b/api.md index f89b3e2..74f9c9b 100644 --- a/api.md +++ b/api.md @@ -155,6 +155,8 @@ Methods: Types: +- ReferenceVoice +- ReferenceAudio - AudioCreateResponse Methods: @@ -169,6 +171,7 @@ Types: - RouterRetrieveResponse - RouterUpdateResponse - RouterListResponse +- RouterListRequestsResponse Methods: @@ -177,18 +180,41 @@ Methods: - client.routers.update(id, { ...params }) -> RouterUpdateResponse - client.routers.list({ ...params }) -> RouterListResponsesCursorPage - client.routers.delete(id) -> void +- client.routers.listRequests(id, { ...params }) -> RouterListRequestsResponsesCursorPage # Organization Types: -- OrganizationRetrieveResponse -- OrganizationRetrieveUsageResponse +- OrganizationRetrieveResponse +- OrganizationRetrieveUsageResponse Methods: -- client.organization.retrieve() -> OrganizationRetrieveResponse -- client.organization.retrieveUsage({ ...params }) -> OrganizationRetrieveUsageResponse +- client.organization.retrieve() -> OrganizationRetrieveResponse +- client.organization.retrieveUsage({ ...params }) -> OrganizationRetrieveUsageResponse + +## Webapp + +Types: + +- WebappListUsageResponse + +Methods: + +- client.organization.webapp.listUsage({ ...params }) -> WebappListUsageResponsesCursorPage + +### AuditLogs + +Types: + +- AuditLogRetrieveResponse +- AuditLogListResponse + +Methods: + +- client.organization.webapp.auditLogs.retrieve(eventID, { ...params }) -> AuditLogRetrieveResponse +- client.organization.webapp.auditLogs.list({ ...params }) -> AuditLogListResponsesCursorPage # Avatars diff --git a/package.json b/package.json index c84d4c7..314b32b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@runwayml/sdk", - "version": "4.13.2", + "version": "4.14.0", "description": "The official TypeScript library for the RunwayML API", "author": "RunwayML ", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index f9f71e4..67687ec 100644 --- a/src/client.ts +++ b/src/client.ts @@ -65,12 +65,6 @@ import { ImageUpscaleCreateParams, ImageUpscaleCreateResponse, } from './resources/image-upscale'; -import { - Organization, - OrganizationRetrieveResponse, - OrganizationRetrieveUsageParams, - OrganizationRetrieveUsageResponse, -} from './resources/organization'; import { DeprecatedLivekit, RealtimeSessionCreateParams, @@ -99,6 +93,9 @@ import { RouterCreateParams, RouterCreateResponse, RouterListParams, + RouterListRequestsParams, + RouterListRequestsResponse, + RouterListRequestsResponsesCursorPage, RouterListResponse, RouterListResponsesCursorPage, RouterRetrieveResponse, @@ -163,6 +160,12 @@ import { Workflows, } from './resources/workflows'; import { Generate } from './resources/generate/generate'; +import { + Organization, + OrganizationRetrieveResponse, + OrganizationRetrieveUsageParams, + OrganizationRetrieveUsageResponse, +} from './resources/organization/organization'; import { type Fetch } from './internal/builtin-types'; import { isRunningInBrowser } from './internal/detect-platform'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; @@ -1105,10 +1108,13 @@ export declare namespace RunwayML { type RouterRetrieveResponse as RouterRetrieveResponse, type RouterUpdateResponse as RouterUpdateResponse, type RouterListResponse as RouterListResponse, + type RouterListRequestsResponse as RouterListRequestsResponse, type RouterListResponsesCursorPage as RouterListResponsesCursorPage, + type RouterListRequestsResponsesCursorPage as RouterListRequestsResponsesCursorPage, type RouterCreateParams as RouterCreateParams, type RouterUpdateParams as RouterUpdateParams, type RouterListParams as RouterListParams, + type RouterListRequestsParams as RouterListRequestsParams, }; export { diff --git a/src/resources/character-performance.ts b/src/resources/character-performance.ts index 8524cd8..87021f8 100644 --- a/src/resources/character-performance.ts +++ b/src/resources/character-performance.ts @@ -43,6 +43,25 @@ export interface CharacterPerformanceCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: CharacterPerformanceCreateResponse.EstimatedCost; +} + +export namespace CharacterPerformanceCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface CharacterPerformanceCreateParams { diff --git a/src/resources/generate/audio.ts b/src/resources/generate/audio.ts index a774a97..0e5cac1 100644 --- a/src/resources/generate/audio.ts +++ b/src/resources/generate/audio.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; +import * as AudioAPI from './audio'; import { RequestOptions } from '../../internal/request-options'; import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../../lib/polling'; @@ -20,6 +21,30 @@ export class Audio extends APIResource { } } +/** + * Clone a voice from a reference audio clip, then speak promptText in that voice. + * Routes only to models that support voice cloning. + */ +export interface ReferenceVoice { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + audioUri: string; + + type: 'reference-audio'; +} + +export interface ReferenceAudio { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + uri: string; +} + export interface AudioCreateResponse { /** * The ID of the created task. Poll GET /v1/tasks/:id for the result. @@ -67,6 +92,12 @@ export namespace AudioCreateResponse { * The resolved config settings the router used for this request. */ resolvedSettings: Routing.ResolvedSettings; + + /** + * Present only when the config enables fallback.onCapacity and capacity affected + * this request. + */ + capacityFallback?: Routing.CapacityFallback; } export namespace Routing { @@ -114,6 +145,24 @@ export namespace AudioCreateResponse { */ priceCeiling: number | null; } + + /** + * Present only when the config enables fallback.onCapacity and capacity affected + * this request. + */ + export interface CapacityFallback { + /** + * True when every eligible model was at its concurrency limit, so the best-ranked + * model was used and the task will queue. + */ + allExhausted: boolean; + + /** + * Eligible models that were considered for this request but not selected because + * this account is at its concurrency limit for them. + */ + skipped: Array; + } } } @@ -166,25 +215,16 @@ export namespace AudioCreateParams { * support them. Reference each clip in promptText as @Audio1, @Audio2, and @Audio3 * in order. */ - referenceAudios?: Array; + referenceAudios?: Array; /** * The voice to speak with. When omitted, models that support a default voice * remain eligible. */ - voice?: Input.Preset | Input.ReferenceAudio; + voice?: Input.Preset | AudioAPI.ReferenceVoice; } export namespace Input { - export interface ReferenceAudio { - /** - * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. - * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See - * [our docs](/assets/inputs#audio) on audio inputs for more information. - */ - uri: string; - } - /** * A preset voice. */ @@ -246,24 +286,14 @@ export namespace AudioCreateParams { type: 'preset'; } - - /** - * Clone a voice from a reference audio clip, then speak promptText in that voice. - * Routes only to models that support voice cloning. - */ - export interface ReferenceAudio { - /** - * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. - * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See - * [our docs](/assets/inputs#audio) on audio inputs for more information. - */ - audioUri: string; - - type: 'reference-audio'; - } } } export declare namespace Audio { - export { type AudioCreateResponse as AudioCreateResponse, type AudioCreateParams as AudioCreateParams }; + export { + type ReferenceVoice as ReferenceVoice, + type ReferenceAudio as ReferenceAudio, + type AudioCreateResponse as AudioCreateResponse, + type AudioCreateParams as AudioCreateParams, + }; } diff --git a/src/resources/generate/generate.ts b/src/resources/generate/generate.ts index e4e5c21..0fee125 100644 --- a/src/resources/generate/generate.ts +++ b/src/resources/generate/generate.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../core/resource'; import * as AudioAPI from './audio'; -import { Audio, AudioCreateParams, AudioCreateResponse } from './audio'; +import { Audio, AudioCreateParams, AudioCreateResponse, ReferenceAudio, ReferenceVoice } from './audio'; import * as ImageAPI from './image'; import { Image, ImageCreateParams, ImageCreateResponse } from './image'; import * as VideoAPI from './video'; @@ -33,6 +33,8 @@ export declare namespace Generate { export { Audio as Audio, + type ReferenceVoice as ReferenceVoice, + type ReferenceAudio as ReferenceAudio, type AudioCreateResponse as AudioCreateResponse, type AudioCreateParams as AudioCreateParams, }; diff --git a/src/resources/generate/image.ts b/src/resources/generate/image.ts index 23a8576..ee97e0b 100644 --- a/src/resources/generate/image.ts +++ b/src/resources/generate/image.ts @@ -66,6 +66,12 @@ export namespace ImageCreateResponse { * The resolved config settings the router used for this request. */ resolvedSettings: Routing.ResolvedSettings; + + /** + * Present only when the config enables fallback.onCapacity and capacity affected + * this request. + */ + capacityFallback?: Routing.CapacityFallback; } export namespace Routing { @@ -117,6 +123,24 @@ export namespace ImageCreateResponse { */ priceCeiling: number | null; } + + /** + * Present only when the config enables fallback.onCapacity and capacity affected + * this request. + */ + export interface CapacityFallback { + /** + * True when every eligible model was at its concurrency limit, so the best-ranked + * model was used and the task will queue. + */ + allExhausted: boolean; + + /** + * Eligible models that were considered for this request but not selected because + * this account is at its concurrency limit for them. + */ + skipped: Array; + } } } diff --git a/src/resources/generate/index.ts b/src/resources/generate/index.ts index 012c6cf..d8df5eb 100644 --- a/src/resources/generate/index.ts +++ b/src/resources/generate/index.ts @@ -1,6 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Audio, type AudioCreateResponse, type AudioCreateParams } from './audio'; +export { + Audio, + type ReferenceVoice, + type ReferenceAudio, + type AudioCreateResponse, + type AudioCreateParams, +} from './audio'; export { Generate } from './generate'; export { Image, type ImageCreateResponse, type ImageCreateParams } from './image'; export { Video, type VideoCreateResponse, type VideoCreateParams } from './video'; diff --git a/src/resources/generate/video.ts b/src/resources/generate/video.ts index 1763740..3c1f4fa 100644 --- a/src/resources/generate/video.ts +++ b/src/resources/generate/video.ts @@ -66,6 +66,12 @@ export namespace VideoCreateResponse { * The resolved config settings the router used for this request. */ resolvedSettings: Routing.ResolvedSettings; + + /** + * Present only when the config enables fallback.onCapacity and capacity affected + * this request. + */ + capacityFallback?: Routing.CapacityFallback; } export namespace Routing { @@ -117,6 +123,24 @@ export namespace VideoCreateResponse { */ priceCeiling: number | null; } + + /** + * Present only when the config enables fallback.onCapacity and capacity affected + * this request. + */ + export interface CapacityFallback { + /** + * True when every eligible model was at its concurrency limit, so the best-ranked + * model was used and the task will queue. + */ + allExhausted: boolean; + + /** + * Eligible models that were considered for this request but not selected because + * this account is at its concurrency limit for them. + */ + skipped: Array; + } } } diff --git a/src/resources/image-to-video.ts b/src/resources/image-to-video.ts index 32ea4b7..0a883f6 100644 --- a/src/resources/image-to-video.ts +++ b/src/resources/image-to-video.ts @@ -26,6 +26,25 @@ export interface ImageToVideoCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: ImageToVideoCreateResponse.EstimatedCost; +} + +export namespace ImageToVideoCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export type ImageToVideoCreateParams = @@ -33,12 +52,13 @@ export type ImageToVideoCreateParams = | ImageToVideoCreateParams.Gen4Turbo | ImageToVideoCreateParams.Veo3_1 | ImageToVideoCreateParams.Veo3_1Fast + | ImageToVideoCreateParams.Hailuo3 | ImageToVideoCreateParams.Happyhorse1_0 | ImageToVideoCreateParams.Seedance2 | ImageToVideoCreateParams.Seedance2Fast | ImageToVideoCreateParams.Seedance2Mini | ImageToVideoCreateParams.GeminiOmniFlash - | ImageToVideoCreateParams.Veo3; + | ImageToVideoCreateParams.Seedance2_5; export declare namespace ImageToVideoCreateParams { export interface Gen4_5 { @@ -73,6 +93,20 @@ export declare namespace ImageToVideoCreateParams { */ contentModeration?: Gen4_5.ContentModeration; + /** + * The container/encoding of the output. `mp4` (default) returns an H.264 .mp4. + * `prores` returns a ProRes .mov. `png_sequence` returns a .zip of PNG frames + * (plus a separate .wav artifact when the output has audio). Non-mp4 formats incur + * an additional surcharge of 5 credits per second of output. + */ + outputFormat?: 'mp4' | 'prores' | 'png_sequence'; + + /** + * The ProRes profile to use. Only valid when `outputFormat` is `prores`. Defaults + * to `4444`. + */ + proresProfile?: '422' | '4444' | '422 Proxy' | '422 LT' | '422 HQ' | '4444 XQ'; + /** * If unspecified, a random number is chosen. Varying the seed integer is a way to * get different results for the same other request parameters. Using the same seed @@ -286,6 +320,60 @@ export declare namespace ImageToVideoCreateParams { } } + export interface Hailuo3 { + model: 'hailuo3'; + + /** + * An image or array of images. Use position `first`/`last` for keyframe mode, or + * omit position for reference images. The two modes cannot be mixed. + */ + promptImage: string | Array; + + /** + * A non-empty text prompt describing what should appear in the output. + */ + promptText: string; + + /** + * The number of seconds of duration for the output video. + */ + duration?: number; + + /** + * The aspect ratio of the output video. Use adaptive only when image or video + * references are provided; text-only requests require a concrete ratio. + */ + ratio?: 'adaptive' | '21:9' | '16:9' | '4:3' | '1:1' | '3:4' | '9:16'; + + /** + * An optional array of audio references. Audio references require a text prompt, + * and the total combined duration must not exceed 15 seconds. + */ + referenceAudio?: Array; + + /** + * The output resolution. Hailuo 3.0 supports 768P and 2K. + */ + resolution?: '2K' | '768P'; + } + + export namespace Hailuo3 { + /** + * An audio reference allows the model to use the audio as additional context for + * the output. + */ + export interface ReferenceAudio { + type: 'audio'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + uri: string; + } + } + export interface Happyhorse1_0 { model: 'happyhorse_1_0'; @@ -385,8 +473,8 @@ export declare namespace ImageToVideoCreateParams { | '2160:3840'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; } @@ -467,8 +555,8 @@ export declare namespace ImageToVideoCreateParams { | '720:1280'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; } @@ -549,8 +637,8 @@ export declare namespace ImageToVideoCreateParams { | '720:1280'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; } @@ -631,50 +719,82 @@ export declare namespace ImageToVideoCreateParams { } } - export interface Veo3 { + export interface Seedance2_5 { + model: 'seedance2_5'; + /** - * The number of seconds of duration for the output video. + * An image or array of images. Use position `first`/`last` for keyframe mode, or + * omit position for reference images. The two modes cannot be mixed. */ - duration: 8; + promptImage: string | Array; - model: 'veo3'; + /** + * Whether to generate audio for the video. + */ + audio?: boolean; /** - * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. - * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See - * [our docs](/assets/inputs#images) on image inputs for more information. + * The number of seconds of duration for the output video. */ - promptImage: string | Array; + duration?: number; /** - * The resolution of the output video. + * An optional text prompt up to 15000 characters describing what should appear in + * the output. */ - ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080'; + promptText?: string; /** - * Text describing what should not appear in the output video. + * The resolution of the output video. Seedance 2.5 supports 480p and 720p only. */ - negativePrompt?: string; + ratio?: + | '992:432' + | '854:480' + | '752:560' + | '640:640' + | '560:752' + | '480:854' + | '1470:630' + | '1280:720' + | '1112:834' + | '960:960' + | '834:1112' + | '720:1280'; /** - * A non-empty string up to 1000 characters (measured in UTF-16 code units). This - * should describe in detail what should appear in the output. + * An optional array of audio references. The total combined duration must not + * exceed 30 seconds. */ - promptText?: string; + referenceAudio?: Array; } - export namespace Veo3 { + export namespace Seedance2_5 { export interface PromptImage { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + uri: string; + /** * The position of the image in the output video. "first" will use the image as the - * first frame of the video. + * first frame, "last" as the last frame. Omit for a reference image. */ - position: 'first'; + position?: 'first' | 'last'; + } + + /** + * An audio reference allows the model to use the audio as additional context for + * the output. + */ + export interface ReferenceAudio { + type: 'audio'; /** * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. - * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See - * [our docs](/assets/inputs#images) on image inputs for more information. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. */ uri: string; } diff --git a/src/resources/image-upscale.ts b/src/resources/image-upscale.ts index e981447..c32cfd6 100644 --- a/src/resources/image-upscale.ts +++ b/src/resources/image-upscale.ts @@ -37,6 +37,25 @@ export interface ImageUpscaleCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: ImageUpscaleCreateResponse.EstimatedCost; +} + +export namespace ImageUpscaleCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface ImageUpscaleCreateParams { diff --git a/src/resources/index.ts b/src/resources/index.ts index 8981d6c..f6b4577 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -52,7 +52,7 @@ export { type OrganizationRetrieveResponse, type OrganizationRetrieveUsageResponse, type OrganizationRetrieveUsageParams, -} from './organization'; +} from './organization/organization'; export { RealtimeSessions, type DeprecatedLivekit, @@ -83,10 +83,13 @@ export { type RouterRetrieveResponse, type RouterUpdateResponse, type RouterListResponse, + type RouterListRequestsResponse, type RouterCreateParams, type RouterUpdateParams, type RouterListParams, + type RouterListRequestsParams, type RouterListResponsesCursorPage, + type RouterListRequestsResponsesCursorPage, } from './routers'; export { SoundEffect, type SoundEffectCreateResponse, type SoundEffectCreateParams } from './sound-effect'; export { diff --git a/src/resources/organization.ts b/src/resources/organization.ts index 3a75126..4e74c0d 100644 --- a/src/resources/organization.ts +++ b/src/resources/organization.ts @@ -1,285 +1,3 @@ // 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 Organization extends APIResource { - /** - * Get usage tier and credit balance information about the organization associated - * with the API key used to make the request. - */ - retrieve(options?: RequestOptions): APIPromise { - return this._client.get('/v1/organization', options); - } - - /** - * Fetch credit usage data broken down by model and day for the organization - * associated with the API key used to make the request. Up to 90 days of data can - * be queried at a time. - */ - retrieveUsage( - body: OrganizationRetrieveUsageParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { - return this._client.post('/v1/organization/usage', { body, ...options }); - } -} - -export interface OrganizationRetrieveResponse { - /** - * The number of credits remaining in the organization account. - */ - creditBalance: number; - - /** - * Limits associated with the organization's tier. - */ - tier: OrganizationRetrieveResponse.Tier; - - /** - * Usage data for the organization. - */ - usage: OrganizationRetrieveResponse.Usage; -} - -export namespace OrganizationRetrieveResponse { - /** - * Limits associated with the organization's tier. - */ - export interface Tier { - /** - * The maximum number of credits that can be purchased in a month. - */ - maxMonthlyCreditSpend: number; - - /** - * An object containing model-specific limits. Each key represents a model. - */ - models: { [key: string]: Tier.Models }; - } - - export namespace Tier { - /** - * Limits associated with the model. - */ - export interface Models { - /** - * The maximum number of generations that can be run concurrently for this model. - */ - maxConcurrentGenerations: number; - - /** - * The maximum number of generations that can be created each day for this model. - */ - maxDailyGenerations: number; - } - } - - /** - * Usage data for the organization. - */ - export interface Usage { - models: { [key: string]: Usage.Models }; - } - - export namespace Usage { - /** - * Usage data for the model. - */ - export interface Models { - /** - * The number of generations that have been run for this model in the past day. - */ - dailyGenerations: number; - } - } -} - -export interface OrganizationRetrieveUsageResponse { - /** - * The list of models with usage during the queried time range. - */ - models: Array< - | 'gen4.5' - | 'gen3a_turbo' - | 'gen4_turbo' - | 'gen4_image' - | 'gen4_image_turbo' - | 'gpt_image_2' - | 'act_two' - | 'gen4_aleph' - | 'veo3' - | 'veo3.1' - | 'veo3.1_fast' - | 'gemini_2.5_flash' - | 'gemini_image3_pro' - | 'gemini_image3.1_flash' - | 'seedream5_pro' - | 'seedream5_lite' - | 'gemini_omni_flash' - | 'eleven_multilingual_v2' - | 'seed_audio' - | 'eleven_v3' - | 'eleven_text_to_sound_v2' - | 'eleven_voice_isolation' - | 'eleven_voice_dubbing' - | 'eleven_multilingual_sts_v2' - | 'eleven_scribe_v2' - | 'gwm1_avatars' - | 'gwm1_avatar_async_audio_to_video' - | 'gwm1_avatar_async_text_to_video' - | 'voice_processing' - | 'seedance2' - | 'seedance2_fast' - | 'seedance2_mini' - | 'magnific_precision_upscaler_v2' - | 'magnific_video_upscaler_creative' - | 'kling2.5_turbo_pro' - | 'kling3.0_pro' - | 'kling3.0_4k' - | 'kling3.0_standard' - | 'klingO3_pro' - | 'klingO3_standard' - | 'klingO3_4k' - | 'happyhorse_1_0' - | 'aleph2' - | 'product_swap' - | 'product_ad' - | 'multi_shot_video' - | 'product_ugc' - | 'marketing_stock_image' - | 'product_campaign_image' - | 'ad_localization' - >; - - results: Array; - - /** - * Reserved for future use. - */ - apiKeys?: Array; - - /** - * Reserved for future use. - */ - resultsByApiKey?: Array; -} - -export namespace OrganizationRetrieveUsageResponse { - export interface Result { - /** - * The date of the usage data in ISO-8601 format (YYYY-MM-DD). All dates are in - * UTC. - */ - date: string; - - /** - * The credits used per model for the given date. - */ - usedCredits: Array; - } - - export namespace Result { - export interface UsedCredit { - /** - * The net number of credits spent on the model. May be negative if refunds - * exceeded charges on this day. - */ - amount: number; - - /** - * The model that credits were spent on. - */ - model: - | 'gen4.5' - | 'gen3a_turbo' - | 'gen4_turbo' - | 'gen4_image' - | 'gen4_image_turbo' - | 'gpt_image_2' - | 'act_two' - | 'gen4_aleph' - | 'veo3' - | 'veo3.1' - | 'veo3.1_fast' - | 'gemini_2.5_flash' - | 'gemini_image3_pro' - | 'gemini_image3.1_flash' - | 'seedream5_pro' - | 'seedream5_lite' - | 'gemini_omni_flash' - | 'eleven_multilingual_v2' - | 'seed_audio' - | 'eleven_v3' - | 'eleven_text_to_sound_v2' - | 'eleven_voice_isolation' - | 'eleven_voice_dubbing' - | 'eleven_multilingual_sts_v2' - | 'eleven_scribe_v2' - | 'gwm1_avatars' - | 'gwm1_avatar_async_audio_to_video' - | 'gwm1_avatar_async_text_to_video' - | 'voice_processing' - | 'seedance2' - | 'seedance2_fast' - | 'seedance2_mini' - | 'magnific_precision_upscaler_v2' - | 'magnific_video_upscaler_creative' - | 'kling2.5_turbo_pro' - | 'kling3.0_pro' - | 'kling3.0_4k' - | 'kling3.0_standard' - | 'klingO3_pro' - | 'klingO3_standard' - | 'klingO3_4k' - | 'happyhorse_1_0' - | 'aleph2' - | 'product_swap' - | 'product_ad' - | 'multi_shot_video' - | 'product_ugc' - | 'marketing_stock_image' - | 'product_campaign_image' - | 'ad_localization'; - } - } - - export interface ResultsByAPIKey { - date: string; - - usedCredits: Array; - } - - export namespace ResultsByAPIKey { - export interface UsedCredit { - amount: number; - - apiKeyId: string; - } - } -} - -export interface OrganizationRetrieveUsageParams { - /** - * The end date of the usage data in ISO-8601 format (YYYY-MM-DD), not inclusive. - * If unspecified, it will default to thirty days after the start date. Must be - * less than or equal to 90 days after the start date. All dates are in UTC. - */ - beforeDate?: string; - - /** - * The start date of the usage data in ISO-8601 format (YYYY-MM-DD). If - * unspecified, it will default to 30 days before the current date. All dates are - * in UTC. - */ - startDate?: string; -} - -export declare namespace Organization { - export { - type OrganizationRetrieveResponse as OrganizationRetrieveResponse, - type OrganizationRetrieveUsageResponse as OrganizationRetrieveUsageResponse, - type OrganizationRetrieveUsageParams as OrganizationRetrieveUsageParams, - }; -} +export * from './organization/index'; diff --git a/src/resources/organization/index.ts b/src/resources/organization/index.ts new file mode 100644 index 0000000..239b70c --- /dev/null +++ b/src/resources/organization/index.ts @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Organization, + type OrganizationRetrieveResponse, + type OrganizationRetrieveUsageResponse, + type OrganizationRetrieveUsageParams, +} from './organization'; +export { + Webapp, + type WebappListUsageResponse, + type WebappListUsageParams, + type WebappListUsageResponsesCursorPage, +} from './webapp/index'; diff --git a/src/resources/organization/organization.ts b/src/resources/organization/organization.ts new file mode 100644 index 0000000..2fda0c8 --- /dev/null +++ b/src/resources/organization/organization.ts @@ -0,0 +1,307 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as WebappAPI from './webapp/webapp'; +import { + Webapp, + WebappListUsageParams, + WebappListUsageResponse, + WebappListUsageResponsesCursorPage, +} from './webapp/webapp'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; + +export class Organization extends APIResource { + webapp: WebappAPI.Webapp = new WebappAPI.Webapp(this._client); + + /** + * Get usage tier and credit balance information about the organization associated + * with the API key used to make the request. + */ + retrieve(options?: RequestOptions): APIPromise { + return this._client.get('/v1/organization', options); + } + + /** + * Fetch credit usage data broken down by model and day for the organization + * associated with the API key used to make the request. Up to 90 days of data can + * be queried at a time. + */ + retrieveUsage( + body: OrganizationRetrieveUsageParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/v1/organization/usage', { body, ...options }); + } +} + +export interface OrganizationRetrieveResponse { + /** + * The number of credits remaining in the organization account. + */ + creditBalance: number; + + /** + * Limits associated with the organization's tier. + */ + tier: OrganizationRetrieveResponse.Tier; + + /** + * Usage data for the organization. + */ + usage: OrganizationRetrieveResponse.Usage; +} + +export namespace OrganizationRetrieveResponse { + /** + * Limits associated with the organization's tier. + */ + export interface Tier { + /** + * The maximum number of credits that can be purchased in a month. + */ + maxMonthlyCreditSpend: number; + + /** + * An object containing model-specific limits. Each key represents a model. + */ + models: { [key: string]: Tier.Models }; + } + + export namespace Tier { + /** + * Limits associated with the model. + */ + export interface Models { + /** + * The maximum number of generations that can be run concurrently for this model. + */ + maxConcurrentGenerations: number; + + /** + * The maximum number of generations that can be created each day for this model. + */ + maxDailyGenerations: number; + } + } + + /** + * Usage data for the organization. + */ + export interface Usage { + models: { [key: string]: Usage.Models }; + } + + export namespace Usage { + /** + * Usage data for the model. + */ + export interface Models { + /** + * The number of generations that have been run for this model in the past day. + */ + dailyGenerations: number; + } + } +} + +export interface OrganizationRetrieveUsageResponse { + /** + * The list of models with usage during the queried time range. + */ + models: Array< + | 'gen4.5' + | 'gen3a_turbo' + | 'gen4_turbo' + | 'gen4_image' + | 'gen4_image_turbo' + | 'gpt_image_2' + | 'act_two' + | 'gen4_aleph' + | 'veo3' + | 'veo3.1' + | 'veo3.1_fast' + | 'gemini_2.5_flash' + | 'gemini_image3_pro' + | 'gemini_image3.1_flash' + | 'seedream5_pro' + | 'seedream5_lite' + | 'gemini_omni_flash' + | 'eleven_multilingual_v2' + | 'seed_audio' + | 'eleven_v3' + | 'eleven_text_to_sound_v2' + | 'eleven_voice_isolation' + | 'eleven_voice_dubbing' + | 'eleven_multilingual_sts_v2' + | 'eleven_scribe_v2' + | 'gwm1_avatars' + | 'gwm1_avatar_async_audio_to_video' + | 'gwm1_avatar_async_text_to_video' + | 'voice_processing' + | 'seedance2' + | 'seedance2_5' + | 'seedance2_fast' + | 'seedance2_mini' + | 'hailuo3' + | 'magnific_precision_upscaler_v2' + | 'magnific_video_upscaler_creative' + | 'kling2.5_turbo_pro' + | 'kling3.0_pro' + | 'kling3.0_4k' + | 'kling3.0_standard' + | 'klingO3_pro' + | 'klingO3_standard' + | 'klingO3_4k' + | 'happyhorse_1_0' + | 'aleph2' + | 'product_swap' + | 'product_ad' + | 'multi_shot_video' + | 'product_ugc' + | 'marketing_stock_image' + | 'product_campaign_image' + | 'ad_localization' + >; + + results: Array; + + /** + * Reserved for future use. + */ + apiKeys?: Array; + + /** + * Reserved for future use. + */ + resultsByApiKey?: Array; +} + +export namespace OrganizationRetrieveUsageResponse { + export interface Result { + /** + * The date of the usage data in ISO-8601 format (YYYY-MM-DD). All dates are in + * UTC. + */ + date: string; + + /** + * The credits used per model for the given date. + */ + usedCredits: Array; + } + + export namespace Result { + export interface UsedCredit { + /** + * The net number of credits spent on the model. May be negative if refunds + * exceeded charges on this day. + */ + amount: number; + + /** + * The model that credits were spent on. + */ + model: + | 'gen4.5' + | 'gen3a_turbo' + | 'gen4_turbo' + | 'gen4_image' + | 'gen4_image_turbo' + | 'gpt_image_2' + | 'act_two' + | 'gen4_aleph' + | 'veo3' + | 'veo3.1' + | 'veo3.1_fast' + | 'gemini_2.5_flash' + | 'gemini_image3_pro' + | 'gemini_image3.1_flash' + | 'seedream5_pro' + | 'seedream5_lite' + | 'gemini_omni_flash' + | 'eleven_multilingual_v2' + | 'seed_audio' + | 'eleven_v3' + | 'eleven_text_to_sound_v2' + | 'eleven_voice_isolation' + | 'eleven_voice_dubbing' + | 'eleven_multilingual_sts_v2' + | 'eleven_scribe_v2' + | 'gwm1_avatars' + | 'gwm1_avatar_async_audio_to_video' + | 'gwm1_avatar_async_text_to_video' + | 'voice_processing' + | 'seedance2' + | 'seedance2_5' + | 'seedance2_fast' + | 'seedance2_mini' + | 'hailuo3' + | 'magnific_precision_upscaler_v2' + | 'magnific_video_upscaler_creative' + | 'kling2.5_turbo_pro' + | 'kling3.0_pro' + | 'kling3.0_4k' + | 'kling3.0_standard' + | 'klingO3_pro' + | 'klingO3_standard' + | 'klingO3_4k' + | 'happyhorse_1_0' + | 'aleph2' + | 'product_swap' + | 'product_ad' + | 'multi_shot_video' + | 'product_ugc' + | 'marketing_stock_image' + | 'product_campaign_image' + | 'ad_localization'; + } + } + + export interface ResultsByAPIKey { + date: string; + + usedCredits: Array; + } + + export namespace ResultsByAPIKey { + export interface UsedCredit { + amount: number; + + apiKeyId: string; + } + } +} + +export interface OrganizationRetrieveUsageParams { + /** + * The end date of the usage data in ISO-8601 format (YYYY-MM-DD), not inclusive. + * If unspecified, it will default to thirty days after the start date. Must be + * less than or equal to 90 days after the start date. All dates are in UTC. + */ + beforeDate?: string; + + /** + * The start date of the usage data in ISO-8601 format (YYYY-MM-DD). If + * unspecified, it will default to 30 days before the current date. All dates are + * in UTC. + */ + startDate?: string; +} + +Organization.Webapp = Webapp; + +export declare namespace Organization { + export { + type OrganizationRetrieveResponse as OrganizationRetrieveResponse, + type OrganizationRetrieveUsageResponse as OrganizationRetrieveUsageResponse, + type OrganizationRetrieveUsageParams as OrganizationRetrieveUsageParams, + }; + + export { + Webapp as Webapp, + type WebappListUsageResponse as WebappListUsageResponse, + type WebappListUsageResponsesCursorPage as WebappListUsageResponsesCursorPage, + type WebappListUsageParams as WebappListUsageParams, + }; +} diff --git a/src/resources/organization/webapp.ts b/src/resources/organization/webapp.ts new file mode 100644 index 0000000..b04d663 --- /dev/null +++ b/src/resources/organization/webapp.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './webapp/index'; diff --git a/src/resources/organization/webapp/audit-logs.ts b/src/resources/organization/webapp/audit-logs.ts new file mode 100644 index 0000000..e983b6b --- /dev/null +++ b/src/resources/organization/webapp/audit-logs.ts @@ -0,0 +1,440 @@ +// 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 { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class AuditLogs extends APIResource { + /** + * Get a single audit log entry, including its metadata and forensic details, for a + * linked Runway workspace you administer. Authorized via the account link between + * this API project and the workspace. + */ + retrieve( + eventID: string, + query: AuditLogRetrieveParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/v1/organization/webapp/audit_logs/${eventID}`, { query, ...options }); + } + + /** + * List audit log entries for the linked Runway workspaces you administer, newest + * first. Authorized via the account link between this API project and the + * workspace. + */ + list( + query: AuditLogListParams, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/v1/organization/webapp/audit_logs', CursorPage, { + query, + ...options, + }); + } +} + +export type AuditLogListResponsesCursorPage = CursorPage; + +export interface AuditLogRetrieveResponse { + /** + * The action performed. + */ + action: + | 'UserLogin' + | 'PasswordChanged' + | 'EmailChangeRequested' + | 'EmailChanged' + | 'UserRegistered' + | 'UserAccountDeleted' + | 'WorkspaceCreated' + | 'WorkspaceDeleted' + | 'MemberInvited' + | 'MemberRemoved' + | 'MemberRoleChanged' + | 'InviteAccepted' + | 'TeamSettingsUpdated' + | 'InviteLinkToggled' + | 'UserGroupCreated' + | 'UserGroupDeleted' + | 'UserGroupMemberAdded' + | 'UserGroupMemberRemoved' + | 'SSOLogin' + | 'SSOUserProvisioned' + | 'SSOConfigCreated' + | 'SSOUserAutoAddedToTeam' + | 'SSODomainRegistrationCloned' + | 'AssetCreated' + | 'AssetUpdated' + | 'AssetDeleted' + | 'AssetDownloaded' + | 'AssetShared' + | 'AssetUnshared' + | 'PermissionGranted' + | 'PermissionUpdated' + | 'PermissionRevoked' + | 'PermissionAccepted' + | 'SubscriptionCancelled' + | 'SubscriptionPlanSwitched' + | 'CreditsTransferred' + | 'SeatsTransferred' + | 'SessionShared' + | 'SessionUnshared' + | 'VideoProjectShared' + | 'VideoProjectUnshared' + | 'BrandKitShared' + | 'BrandKitUnshared' + | 'AgentCustomSkillCreated' + | 'AgentCustomSkillDeleted' + | 'AgentCustomSkillShared' + | 'AgentCustomSkillUnshared' + | 'AgentSessionShared' + | 'AgentSessionUnshared' + | 'AgentConnectorLinkTokenCreated' + | 'AgentConnectorConnected' + | 'AgentConnectorDisconnected' + | 'AgentConnectorAssetExported' + | 'AgentConnectorSessionEnabled' + | 'AgentConnectorSessionDisabled' + | 'GenerationCreated' + | 'AccountLinkCreated' + | 'AccountLinkDeleted' + | 'OrganizationSettingsUpdated' + | 'OrganizationDisabledModelsUpdated' + | 'WorkspaceCountryLockUpdated' + | 'WorkspaceTagCreated' + | 'WorkspaceTagUpdated' + | 'WorkspaceTagDeleted' + | 'WorkspaceTagAssigned' + | 'WorkspaceTagUnassigned' + | 'MeteredBillingConfigUpdated' + | 'MeteredBillingRefillTriggered' + | 'MeteredBillingRetryTriggered' + | 'EnterpriseSpendCapEnforcementUpdated'; + + /** + * Whether the acting user has since been deleted. + */ + actorDeleted: boolean; + + /** + * Email of the user who performed the action. + */ + actorEmail: string | null; + + /** + * Username of the user who performed the action. + */ + actorUsername: string | null; + + /** + * IP address of the client that performed the action. + */ + clientIpAddress: string; + + /** + * Unique identifier of the entry. + */ + eventId: string; + + /** + * Action-specific details. + */ + metadata: AuditLogRetrieveResponse.Metadata; + + /** + * Request ID for correlation with other logs. + */ + requestId: string | null; + + /** + * ID of the affected resource, if any. + */ + resourceId: string | null; + + /** + * Type of the affected resource, if any. Currently one of `account_link`, + * `agent_custom_skill`, `asset`, `brand_kit`, `generation`, `invite_link`, + * `membership`, `organization`, `permission`, `promotion`, `session`, + * `shared_asset`, `sso_config`, `sso_domain_registration`, `subscription`, + * `team_settings`, `user`, `user_group`, `video_project`, `workspace`, or + * `workspace_tag`. New types may be added over time, so treat this as an open set. + */ + resourceType: string | null; + + /** + * When the action occurred. + */ + timestamp: string; + + /** + * User-Agent header of the client request. + */ + userAgent: string | null; + + /** + * ID of the owning workspace. + */ + workspaceId: number; + + /** + * Name of the owning workspace. + */ + workspaceName: string; +} + +export namespace AuditLogRetrieveResponse { + /** + * Action-specific details. + */ + export interface Metadata { + Amount?: unknown; + + Application?: unknown; + + 'Asset name'?: unknown; + + 'Default task name template'?: unknown; + + 'Group name'?: unknown; + + 'Hard spend cap'?: unknown; + + 'Invited member'?: unknown; + + 'Login method'?: unknown; + + 'Member email'?: unknown; + + Model?: unknown; + + 'New role'?: unknown; + + 'New User'?: unknown; + + Operation?: unknown; + + Plan?: unknown; + + Platform?: unknown; + + 'Previous role'?: unknown; + + 'Removed member'?: unknown; + + Role?: unknown; + + 'Shared with projects'?: unknown; + + 'Shared with workspace'?: unknown; + + 'Spend cap'?: unknown; + + 'Tag color'?: unknown; + + 'Tag name'?: unknown; + + 'Target member'?: unknown; + + Workspace?: unknown; + + 'Workspace description'?: unknown; + + 'Workspace ID'?: unknown; + + 'Workspace name'?: unknown; + + 'Workspace picture'?: unknown; + } +} + +export interface AuditLogListResponse { + /** + * The action performed. + */ + action: + | 'UserLogin' + | 'PasswordChanged' + | 'EmailChangeRequested' + | 'EmailChanged' + | 'UserRegistered' + | 'UserAccountDeleted' + | 'WorkspaceCreated' + | 'WorkspaceDeleted' + | 'MemberInvited' + | 'MemberRemoved' + | 'MemberRoleChanged' + | 'InviteAccepted' + | 'TeamSettingsUpdated' + | 'InviteLinkToggled' + | 'UserGroupCreated' + | 'UserGroupDeleted' + | 'UserGroupMemberAdded' + | 'UserGroupMemberRemoved' + | 'SSOLogin' + | 'SSOUserProvisioned' + | 'SSOConfigCreated' + | 'SSOUserAutoAddedToTeam' + | 'SSODomainRegistrationCloned' + | 'AssetCreated' + | 'AssetUpdated' + | 'AssetDeleted' + | 'AssetDownloaded' + | 'AssetShared' + | 'AssetUnshared' + | 'PermissionGranted' + | 'PermissionUpdated' + | 'PermissionRevoked' + | 'PermissionAccepted' + | 'SubscriptionCancelled' + | 'SubscriptionPlanSwitched' + | 'CreditsTransferred' + | 'SeatsTransferred' + | 'SessionShared' + | 'SessionUnshared' + | 'VideoProjectShared' + | 'VideoProjectUnshared' + | 'BrandKitShared' + | 'BrandKitUnshared' + | 'AgentCustomSkillCreated' + | 'AgentCustomSkillDeleted' + | 'AgentCustomSkillShared' + | 'AgentCustomSkillUnshared' + | 'AgentSessionShared' + | 'AgentSessionUnshared' + | 'AgentConnectorLinkTokenCreated' + | 'AgentConnectorConnected' + | 'AgentConnectorDisconnected' + | 'AgentConnectorAssetExported' + | 'AgentConnectorSessionEnabled' + | 'AgentConnectorSessionDisabled' + | 'GenerationCreated' + | 'AccountLinkCreated' + | 'AccountLinkDeleted' + | 'OrganizationSettingsUpdated' + | 'OrganizationDisabledModelsUpdated' + | 'WorkspaceCountryLockUpdated' + | 'WorkspaceTagCreated' + | 'WorkspaceTagUpdated' + | 'WorkspaceTagDeleted' + | 'WorkspaceTagAssigned' + | 'WorkspaceTagUnassigned' + | 'MeteredBillingConfigUpdated' + | 'MeteredBillingRefillTriggered' + | 'MeteredBillingRetryTriggered' + | 'EnterpriseSpendCapEnforcementUpdated'; + + /** + * Whether the acting user has since been deleted. + */ + actorDeleted: boolean; + + /** + * Email of the user who performed the action. + */ + actorEmail: string | null; + + /** + * Username of the user who performed the action. + */ + actorUsername: string | null; + + /** + * Unique identifier of the entry. + */ + eventId: string; + + /** + * When the action occurred. + */ + timestamp: string; + + /** + * ID of the owning workspace. + */ + workspaceId: number; + + /** + * Name of the owning workspace. + */ + workspaceName: string; +} + +export interface AuditLogRetrieveParams { + /** + * Organization to report on. Optional when this API project is linked to a single + * organization; required when it is linked to more than one. + */ + organizationId?: string; +} + +export interface AuditLogListParams extends CursorPageParams { + /** + * Restrict results to these audit log actions, as a comma-separated list of up to + * 50 actions. Allowed values: `UserLogin`, `PasswordChanged`, + * `EmailChangeRequested`, `EmailChanged`, `UserRegistered`, `UserAccountDeleted`, + * `WorkspaceCreated`, `WorkspaceDeleted`, `MemberInvited`, `MemberRemoved`, + * `MemberRoleChanged`, `InviteAccepted`, `TeamSettingsUpdated`, + * `InviteLinkToggled`, `UserGroupCreated`, `UserGroupDeleted`, + * `UserGroupMemberAdded`, `UserGroupMemberRemoved`, `SSOLogin`, + * `SSOUserProvisioned`, `SSOConfigCreated`, `SSOUserAutoAddedToTeam`, + * `SSODomainRegistrationCloned`, `AssetCreated`, `AssetUpdated`, `AssetDeleted`, + * `AssetDownloaded`, `AssetShared`, `AssetUnshared`, `PermissionGranted`, + * `PermissionUpdated`, `PermissionRevoked`, `PermissionAccepted`, + * `SubscriptionCancelled`, `SubscriptionPlanSwitched`, `CreditsTransferred`, + * `SeatsTransferred`, `SessionShared`, `SessionUnshared`, `VideoProjectShared`, + * `VideoProjectUnshared`, `BrandKitShared`, `BrandKitUnshared`, + * `AgentCustomSkillCreated`, `AgentCustomSkillDeleted`, `AgentCustomSkillShared`, + * `AgentCustomSkillUnshared`, `AgentSessionShared`, `AgentSessionUnshared`, + * `AgentConnectorLinkTokenCreated`, `AgentConnectorConnected`, + * `AgentConnectorDisconnected`, `AgentConnectorAssetExported`, + * `AgentConnectorSessionEnabled`, `AgentConnectorSessionDisabled`, + * `GenerationCreated`, `AccountLinkCreated`, `AccountLinkDeleted`, + * `OrganizationSettingsUpdated`, `OrganizationDisabledModelsUpdated`, + * `WorkspaceCountryLockUpdated`, `WorkspaceTagCreated`, `WorkspaceTagUpdated`, + * `WorkspaceTagDeleted`, `WorkspaceTagAssigned`, `WorkspaceTagUnassigned`, + * `MeteredBillingConfigUpdated`, `MeteredBillingRefillTriggered`, + * `MeteredBillingRetryTriggered`, `EnterpriseSpendCapEnforcementUpdated`. + */ + actions?: string; + + /** + * Restrict results to entries performed by the users with these emails, as a + * comma-separated list of up to 50 emails. + */ + actorEmails?: string; + + /** + * Start of the time window (inclusive), ISO-8601 datetime. + */ + from?: string; + + /** + * Organization to report on. Optional when this API project is linked to a single + * organization; required when it is linked to more than one. + */ + organizationId?: string; + + /** + * End of the time window (exclusive), ISO-8601 datetime. + */ + to?: string; + + /** + * Restrict results to these workspace IDs, as a comma-separated list of up to 50 + * IDs. Defaults to every workspace you administer in the organization. + */ + workspaceIds?: string; +} + +export declare namespace AuditLogs { + export { + type AuditLogRetrieveResponse as AuditLogRetrieveResponse, + type AuditLogListResponse as AuditLogListResponse, + type AuditLogListResponsesCursorPage as AuditLogListResponsesCursorPage, + type AuditLogRetrieveParams as AuditLogRetrieveParams, + type AuditLogListParams as AuditLogListParams, + }; +} diff --git a/src/resources/organization/webapp/index.ts b/src/resources/organization/webapp/index.ts new file mode 100644 index 0000000..0ea98eb --- /dev/null +++ b/src/resources/organization/webapp/index.ts @@ -0,0 +1,16 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + AuditLogs, + type AuditLogRetrieveResponse, + type AuditLogListResponse, + type AuditLogRetrieveParams, + type AuditLogListParams, + type AuditLogListResponsesCursorPage, +} from './audit-logs'; +export { + Webapp, + type WebappListUsageResponse, + type WebappListUsageParams, + type WebappListUsageResponsesCursorPage, +} from './webapp'; diff --git a/src/resources/organization/webapp/webapp.ts b/src/resources/organization/webapp/webapp.ts new file mode 100644 index 0000000..210125d --- /dev/null +++ b/src/resources/organization/webapp/webapp.ts @@ -0,0 +1,118 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as AuditLogsAPI from './audit-logs'; +import { + AuditLogListParams, + AuditLogListResponse, + AuditLogListResponsesCursorPage, + AuditLogRetrieveParams, + AuditLogRetrieveResponse, + AuditLogs, +} from './audit-logs'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; +import { RequestOptions } from '../../../internal/request-options'; + +export class Webapp extends APIResource { + auditLogs: AuditLogsAPI.AuditLogs = new AuditLogsAPI.AuditLogs(this._client); + + /** + * List per-generation credit-usage rows for the linked Runway workspaces you + * administer, newest first. Unlike `/v1/organization/usage` (this API project's + * own usage), this reports usage from the workspace linked to this API project. + * Authorized via that account link. + */ + listUsage( + query: WebappListUsageParams, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/v1/organization/webapp/usage', CursorPage, { + query, + ...options, + }); + } +} + +export type WebappListUsageResponsesCursorPage = CursorPage; + +export interface WebappListUsageResponse { + /** + * Credits charged for this generation. + */ + credits: number; + + /** + * Email of the user who generated. + */ + email: string; + + /** + * When the generation was charged. + */ + timestamp: string; + + /** + * Model/task display name for the generation. + */ + tool: string; + + /** + * Whether the row is a credit charge for a generation or a task refund (negative + * credits). + */ + type: 'charge' | 'refund'; + + /** + * ID of the owning workspace. + */ + workspaceId: number; + + /** + * Name of the owning workspace. + */ + workspaceName: string; +} + +export interface WebappListUsageParams extends CursorPageParams { + /** + * Start of the time window (inclusive), ISO-8601 datetime. + */ + from: string; + + /** + * End of the time window (exclusive), ISO-8601 datetime. A `cursor` can only + * narrow this window, never extend it past `to`. + */ + to: string; + + /** + * Organization to report on. Optional when this API project is linked to a single + * organization; required when it is linked to more than one. + */ + organizationId?: string; + + /** + * Restrict results to these workspace IDs, as a comma-separated list. Defaults to + * every workspace you administer in the organization. + */ + workspaceIds?: string; +} + +Webapp.AuditLogs = AuditLogs; + +export declare namespace Webapp { + export { + type WebappListUsageResponse as WebappListUsageResponse, + type WebappListUsageResponsesCursorPage as WebappListUsageResponsesCursorPage, + type WebappListUsageParams as WebappListUsageParams, + }; + + export { + AuditLogs as AuditLogs, + type AuditLogRetrieveResponse as AuditLogRetrieveResponse, + type AuditLogListResponse as AuditLogListResponse, + type AuditLogListResponsesCursorPage as AuditLogListResponsesCursorPage, + type AuditLogRetrieveParams as AuditLogRetrieveParams, + type AuditLogListParams as AuditLogListParams, + }; +} diff --git a/src/resources/recipes.ts b/src/resources/recipes.ts index 37757f1..3a9fc24 100644 --- a/src/resources/recipes.ts +++ b/src/resources/recipes.ts @@ -101,6 +101,25 @@ export interface RecipeAdLocalizationResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeAdLocalizationResponse.EstimatedCost; +} + +export namespace RecipeAdLocalizationResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeMarketingStockImageResponse { @@ -108,6 +127,25 @@ export interface RecipeMarketingStockImageResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeMarketingStockImageResponse.EstimatedCost; +} + +export namespace RecipeMarketingStockImageResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeMultiShotVideoResponse { @@ -115,6 +153,25 @@ export interface RecipeMultiShotVideoResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeMultiShotVideoResponse.EstimatedCost; +} + +export namespace RecipeMultiShotVideoResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeProductAdResponse { @@ -122,6 +179,25 @@ export interface RecipeProductAdResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeProductAdResponse.EstimatedCost; +} + +export namespace RecipeProductAdResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeProductCampaignImageResponse { @@ -129,6 +205,25 @@ export interface RecipeProductCampaignImageResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeProductCampaignImageResponse.EstimatedCost; +} + +export namespace RecipeProductCampaignImageResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeProductSwapResponse { @@ -136,6 +231,25 @@ export interface RecipeProductSwapResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeProductSwapResponse.EstimatedCost; +} + +export namespace RecipeProductSwapResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeProductUgcResponse { @@ -143,6 +257,25 @@ export interface RecipeProductUgcResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: RecipeProductUgcResponse.EstimatedCost; +} + +export namespace RecipeProductUgcResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface RecipeAdLocalizationParams { diff --git a/src/resources/routers.ts b/src/resources/routers.ts index 85f9432..eb93bc6 100644 --- a/src/resources/routers.ts +++ b/src/resources/routers.ts @@ -56,10 +56,27 @@ export class Routers extends APIResource { headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } + + /** + * Paginated routing history for live Model Router requests (successful routes and + * failures). Playground dry runs are not recorded. + */ + listRequests( + id: string, + query: RouterListRequestsParams, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList(path`/v1/routers/${id}/requests`, CursorPage, { + query, + ...options, + }); + } } export type RouterListResponsesCursorPage = CursorPage; +export type RouterListRequestsResponsesCursorPage = CursorPage; + export interface RouterCreateResponse { /** * The Model Router's primary key ID (UUID). Use it to manage this router via the @@ -111,6 +128,12 @@ export namespace RouterCreateResponse { */ schemaVersion: 1; + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + fallback?: Settings.Fallback; + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -131,6 +154,20 @@ export namespace RouterCreateResponse { } export namespace Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + export interface Fallback { + /** + * When true, if the account is at its concurrency limit on the preferred model, + * routing skips it and picks the next-best eligible model instead of queueing. If + * every eligible model is at its limit, the original best-ranked model is used and + * the task queues as usual. + */ + onCapacity?: boolean; + } + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -207,6 +244,12 @@ export namespace RouterRetrieveResponse { */ schemaVersion: 1; + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + fallback?: Settings.Fallback; + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -227,6 +270,20 @@ export namespace RouterRetrieveResponse { } export namespace Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + export interface Fallback { + /** + * When true, if the account is at its concurrency limit on the preferred model, + * routing skips it and picks the next-best eligible model instead of queueing. If + * every eligible model is at its limit, the original best-ranked model is used and + * the task queues as usual. + */ + onCapacity?: boolean; + } + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -303,6 +360,12 @@ export namespace RouterUpdateResponse { */ schemaVersion: 1; + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + fallback?: Settings.Fallback; + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -323,6 +386,20 @@ export namespace RouterUpdateResponse { } export namespace Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + export interface Fallback { + /** + * When true, if the account is at its concurrency limit on the preferred model, + * routing skips it and picks the next-best eligible model instead of queueing. If + * every eligible model is at its limit, the original best-ranked model is used and + * the task queues as usual. + */ + onCapacity?: boolean; + } + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -402,6 +479,12 @@ export namespace RouterListResponse { */ schemaVersion: 1; + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + fallback?: Settings.Fallback; + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -422,6 +505,20 @@ export namespace RouterListResponse { } export namespace Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + export interface Fallback { + /** + * When true, if the account is at its concurrency limit on the preferred model, + * routing skips it and picks the next-best eligible model instead of queueing. If + * every eligible model is at its limit, the original best-ranked model is used and + * the task queues as usual. + */ + onCapacity?: boolean; + } + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -447,6 +544,111 @@ export namespace RouterListResponse { } } +/** + * A recorded Model Router routing decision. + */ +export interface RouterListRequestsResponse { + id: string; + + createdAt: string; + + /** + * The filter(s) that reduced the eligible pool to zero. + */ + emptiedBy: Array<'capability' | 'prompt_length' | 'input_support' | 'allow_deny' | 'price'>; + + estimatedCredits: number | null; + + model: string | null; + + /** + * Ordered routing story: hard-filter stages with surviving model ids, a capacity + * step when concurrency limits affected the pool, then rank step when selection + * reached ranking. + */ + pipeline: Array< + RouterListRequestsResponse.Filter | RouterListRequestsResponse.Capacity | RouterListRequestsResponse.Rank + >; + + provider: string | null; + + /** + * Free-text explanation of the pick. Written by the ranker, so treat it as prose + * for humans and group on reasonCode instead. + */ + reason: string | null; + + /** + * Why the model won: lowest_cost, best_latency, best_quality, only_eligible_model, + * or filter_order_fallback (ranking was unavailable, so hard-filter order stood). + * Null when the request never reached ranking. + */ + reasonCode: + | 'lowest_cost' + | 'best_latency' + | 'best_quality' + | 'only_eligible_model' + | 'filter_order_fallback' + | null; + + requestId: string; + + /** + * How the routing attempt ended: routed (model selected), no_eligible_model (hard + * filters emptied the pool), router_config_not_found (same condition as the + * generate error of that name), invalid_request, or error. + */ + status: 'routed' | 'no_eligible_model' | 'router_config_not_found' | 'invalid_request' | 'error'; + + taskId: string | null; +} + +export namespace RouterListRequestsResponse { + export interface Filter { + /** + * Hard-filter stage that ran: capability (modality/feature fit), prompt_length + * (prompt within model limits), input_support (requested inputs/assets), + * allow_deny (router model allowlist/denylist), or price (credit ceiling). + */ + filter: 'capability' | 'prompt_length' | 'input_support' | 'allow_deny' | 'price'; + + /** + * Model IDs of the models that remained eligible after this filter stage. + */ + models: Array; + + type: 'filter'; + } + + export interface Capacity { + /** + * True when every eligible model was at its limit, in which case none was skipped + * and the selected task queues. + */ + allExhausted: boolean; + + /** + * Model IDs that were eligible but passed over because the account was at its + * concurrency limit for them. + */ + skipped: Array; + + type: 'capacity'; + } + + export interface Rank { + /** + * How the router chose among eligible models: cost (sorted by estimated credits), + * selected (preference ranking chose a model), fallback (preference ranking failed + * so the eligible models were left in filter order), or single_candidate (only one + * model remained). + */ + outcome: 'cost' | 'selected' | 'fallback' | 'single_candidate'; + + type: 'rank'; + } +} + export interface RouterCreateParams { /** * Immutable slug used to reference this Model Router in generation requests (for @@ -481,6 +683,12 @@ export namespace RouterCreateParams { * Router. */ export interface Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + fallback?: Settings.Fallback; + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -507,6 +715,20 @@ export namespace RouterCreateParams { } export namespace Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + export interface Fallback { + /** + * When true, if the account is at its concurrency limit on the preferred model, + * routing skips it and picks the next-best eligible model instead of queueing. If + * every eligible model is at its limit, the original best-ranked model is used and + * the task queues as usual. + */ + onCapacity?: boolean; + } + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -555,6 +777,12 @@ export namespace RouterUpdateParams { * optimizeFor does not clear the model allowlist or credit ceiling). */ export interface Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + fallback?: Settings.Fallback; + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -581,6 +809,20 @@ export namespace RouterUpdateParams { } export namespace Settings { + /** + * Opt-in behavior for what routing should do when the preferred model cannot start + * immediately. + */ + export interface Fallback { + /** + * When true, if the account is at its concurrency limit on the preferred model, + * routing skips it and picks the next-best eligible model instead of queueing. If + * every eligible model is at its limit, the original best-ranked model is used and + * the task queues as usual. + */ + onCapacity?: boolean; + } + /** * Optional per-modality credit caps, applied per generated output. Models whose * estimated per-output cost exceeds the cap are excluded. @@ -608,15 +850,20 @@ export namespace RouterUpdateParams { export interface RouterListParams extends CursorPageParams {} +export interface RouterListRequestsParams extends CursorPageParams {} + export declare namespace Routers { export { type RouterCreateResponse as RouterCreateResponse, type RouterRetrieveResponse as RouterRetrieveResponse, type RouterUpdateResponse as RouterUpdateResponse, type RouterListResponse as RouterListResponse, + type RouterListRequestsResponse as RouterListRequestsResponse, type RouterListResponsesCursorPage as RouterListResponsesCursorPage, + type RouterListRequestsResponsesCursorPage as RouterListRequestsResponsesCursorPage, type RouterCreateParams as RouterCreateParams, type RouterUpdateParams as RouterUpdateParams, type RouterListParams as RouterListParams, + type RouterListRequestsParams as RouterListRequestsParams, }; } diff --git a/src/resources/sound-effect.ts b/src/resources/sound-effect.ts index 9bab760..5a54013 100644 --- a/src/resources/sound-effect.ts +++ b/src/resources/sound-effect.ts @@ -27,6 +27,25 @@ export interface SoundEffectCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: SoundEffectCreateResponse.EstimatedCost; +} + +export namespace SoundEffectCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export type SoundEffectCreateParams = diff --git a/src/resources/speech-to-speech.ts b/src/resources/speech-to-speech.ts index 7242aa1..f890427 100644 --- a/src/resources/speech-to-speech.ts +++ b/src/resources/speech-to-speech.ts @@ -26,6 +26,25 @@ export interface SpeechToSpeechCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: SpeechToSpeechCreateResponse.EstimatedCost; +} + +export namespace SpeechToSpeechCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface SpeechToSpeechCreateParams { diff --git a/src/resources/tasks.ts b/src/resources/tasks.ts index b6b53e4..1a1c9ad 100644 --- a/src/resources/tasks.ts +++ b/src/resources/tasks.ts @@ -64,9 +64,26 @@ export namespace TaskRetrieveResponse { */ createdAt: string; + /** + * Estimated cost, computed against current pricing. + */ + estimatedCost: Pending.EstimatedCost; + status: 'PENDING'; } + export namespace Pending { + /** + * Estimated cost, computed against current pricing. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } + } + /** * A throttled task */ @@ -81,9 +98,26 @@ export namespace TaskRetrieveResponse { */ createdAt: string; + /** + * Estimated cost, computed against current pricing. + */ + estimatedCost: Throttled.EstimatedCost; + status: 'THROTTLED'; } + export namespace Throttled { + /** + * Estimated cost, computed against current pricing. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } + } + /** * A cancelled or deleted task */ @@ -93,6 +127,11 @@ export namespace TaskRetrieveResponse { */ id: string; + /** + * Final cost in credits for a terminal task. A refunded task reports 0. + */ + cost: Cancelled.Cost; + /** * The timestamp that the task was submitted at. */ @@ -101,6 +140,18 @@ export namespace TaskRetrieveResponse { status: 'CANCELLED'; } + export namespace Cancelled { + /** + * Final cost in credits for a terminal task. A refunded task reports 0. + */ + export interface Cost { + /** + * Credits charged for this task. + */ + credits: number; + } + } + /** * A running task */ @@ -115,11 +166,28 @@ export namespace TaskRetrieveResponse { */ createdAt: string; + /** + * Estimated cost, computed against current pricing. + */ + estimatedCost: Running.EstimatedCost; + progress: number; status: 'RUNNING'; } + export namespace Running { + /** + * Estimated cost, computed against current pricing. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } + } + /** * A failed task */ @@ -129,6 +197,11 @@ export namespace TaskRetrieveResponse { */ id: string; + /** + * Final cost in credits for a terminal task. A refunded task reports 0. + */ + cost: Failed.Cost; + /** * The timestamp that the task was submitted at. */ @@ -149,6 +222,18 @@ export namespace TaskRetrieveResponse { failureCode?: string; } + export namespace Failed { + /** + * Final cost in credits for a terminal task. A refunded task reports 0. + */ + export interface Cost { + /** + * Credits charged for this task. + */ + credits: number; + } + } + /** * A succeeded task */ @@ -158,6 +243,11 @@ export namespace TaskRetrieveResponse { */ id: string; + /** + * Final cost in credits for a terminal task. A refunded task reports 0. + */ + cost: Succeeded.Cost; + /** * The timestamp that the task was submitted at. */ @@ -172,6 +262,18 @@ export namespace TaskRetrieveResponse { status: 'SUCCEEDED'; } + + export namespace Succeeded { + /** + * Final cost in credits for a terminal task. A refunded task reports 0. + */ + export interface Cost { + /** + * Credits charged for this task. + */ + credits: number; + } + } } export declare namespace Tasks { diff --git a/src/resources/text-to-image.ts b/src/resources/text-to-image.ts index 92ff680..c1c0ddb 100644 --- a/src/resources/text-to-image.ts +++ b/src/resources/text-to-image.ts @@ -26,6 +26,25 @@ export interface TextToImageCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: TextToImageCreateResponse.EstimatedCost; +} + +export namespace TextToImageCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export type TextToImageCreateParams = @@ -571,6 +590,12 @@ export declare namespace TextToImageCreateParams { | '2496:3744' | '4704:2016'; + /** + * When true, enable live web search so the model can use current brand, trend, or + * event context. Default false for deterministic output. + */ + grounding?: boolean; + /** * The number of images to generate. Increasing this number will affect the number * of credits consumed by the generation. diff --git a/src/resources/text-to-speech.ts b/src/resources/text-to-speech.ts index c5595fd..4421708 100644 --- a/src/resources/text-to-speech.ts +++ b/src/resources/text-to-speech.ts @@ -26,11 +26,31 @@ export interface TextToSpeechCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: TextToSpeechCreateResponse.EstimatedCost; +} + +export namespace TextToSpeechCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export type TextToSpeechCreateParams = | TextToSpeechCreateParams.SeedAudio - | TextToSpeechCreateParams.ElevenMultilingualV2; + | TextToSpeechCreateParams.ElevenMultilingualV2 + | TextToSpeechCreateParams.ElevenV3; export declare namespace TextToSpeechCreateParams { export interface SeedAudio { @@ -167,6 +187,127 @@ export declare namespace TextToSpeechCreateParams { type: 'runway-preset'; } } + + export interface ElevenV3 { + model: 'eleven_v3'; + + /** + * The text to convert to speech. You can include expressive audio tags like + * [laughs] or [whispers] in the script. + */ + promptText: string; + + /** + * A voice preset from the RunwayML API. + */ + voice: ElevenV3.Voice; + + /** + * Text normalization mode: 'auto', 'on', or 'off' (e.g. spelling out numbers). + */ + applyTextNormalization?: 'auto' | 'on' | 'off'; + + /** + * ISO 639-1 language code to enforce pronunciation and normalization. + */ + languageCode?: string; + + /** + * Optional seed for more deterministic output (0–4294967295). Not guaranteed. + */ + seed?: number; + + /** + * How closely the output tracks the original speaker (0–1). Maps to ElevenLabs + * similarity_boost. + */ + similarityBoost?: number; + + /** + * Speech speed multiplier (0.7–1.2). 1.0 is default; values below slow down and + * above speed up. + */ + speed?: number; + + /** + * Voice stability (0–1). Lower values allow broader emotional range; higher values + * are steadier. + */ + stability?: number; + + /** + * Style exaggeration (0–1). Higher values amplify the speaker style. + */ + style?: number; + + /** + * Boost similarity to the original speaker at a small latency cost. + */ + useSpeakerBoost?: boolean; + } + + export namespace ElevenV3 { + /** + * A voice preset from the RunwayML API. + */ + export interface Voice { + /** + * The preset voice ID to use for the generated speech. + */ + presetId: + | 'Maya' + | 'Arjun' + | 'Serene' + | 'Bernard' + | 'Billy' + | 'Mark' + | 'Clint' + | 'Mabel' + | 'Chad' + | 'Leslie' + | 'Eleanor' + | 'Elias' + | 'Elliot' + | 'Grungle' + | 'Brodie' + | 'Sandra' + | 'Kirk' + | 'Kylie' + | 'Lara' + | 'Lisa' + | 'Malachi' + | 'Marlene' + | 'Martin' + | 'Miriam' + | 'Monster' + | 'Paula' + | 'Pip' + | 'Rusty' + | 'Ragnar' + | 'Xylar' + | 'Maggie' + | 'Jack' + | 'Katie' + | 'Noah' + | 'James' + | 'Rina' + | 'Ella' + | 'Mariah' + | 'Frank' + | 'Claudia' + | 'Niki' + | 'Vincent' + | 'Kendrick' + | 'Myrna' + | 'Tom' + | 'Wanda' + | 'Benjamin' + | 'Kiana' + | 'Rachel'; + + type: 'runway-preset'; + } + } } export declare namespace TextToSpeech { diff --git a/src/resources/text-to-video.ts b/src/resources/text-to-video.ts index 56de43f..e49a614 100644 --- a/src/resources/text-to-video.ts +++ b/src/resources/text-to-video.ts @@ -26,18 +26,38 @@ export interface TextToVideoCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: TextToVideoCreateResponse.EstimatedCost; +} + +export namespace TextToVideoCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export type TextToVideoCreateParams = | TextToVideoCreateParams.Gen4_5 | TextToVideoCreateParams.Veo3_1 | TextToVideoCreateParams.Veo3_1Fast + | TextToVideoCreateParams.Hailuo3 | TextToVideoCreateParams.Happyhorse1_0 | TextToVideoCreateParams.Seedance2 | TextToVideoCreateParams.Seedance2Fast | TextToVideoCreateParams.Seedance2Mini | TextToVideoCreateParams.GeminiOmniFlash - | TextToVideoCreateParams.Veo3; + | TextToVideoCreateParams.Seedance2_5; export declare namespace TextToVideoCreateParams { export interface Gen4_5 { @@ -65,6 +85,20 @@ export declare namespace TextToVideoCreateParams { */ contentModeration?: Gen4_5.ContentModeration; + /** + * The container/encoding of the output. `mp4` (default) returns an H.264 .mp4. + * `prores` returns a ProRes .mov. `png_sequence` returns a .zip of PNG frames + * (plus a separate .wav artifact when the output has audio). Non-mp4 formats incur + * an additional surcharge of 5 credits per second of output. + */ + outputFormat?: 'mp4' | 'prores' | 'png_sequence'; + + /** + * The ProRes profile to use. Only valid when `outputFormat` is `prores`. Defaults + * to `4444`. + */ + proresProfile?: '422' | '4444' | '422 Proxy' | '422 LT' | '422 HQ' | '4444 XQ'; + /** * If unspecified, a random number is chosen. Varying the seed integer is a way to * get different results for the same other request parameters. Using the same seed @@ -146,6 +180,91 @@ export declare namespace TextToVideoCreateParams { negativePrompt?: string; } + export interface Hailuo3 { + model: 'hailuo3'; + + /** + * A non-empty text prompt describing what should appear in the output. + */ + promptText: string; + + /** + * The number of seconds of duration for the output video. + */ + duration?: number; + + /** + * The aspect ratio of the output video. Use adaptive only when image or video + * references are provided; text-only requests require a concrete ratio. + */ + ratio?: 'adaptive' | '21:9' | '16:9' | '4:3' | '1:1' | '3:4' | '9:16'; + + /** + * An optional array of audio references. Audio references require a text prompt, + * and the total combined duration must not exceed 15 seconds. + */ + referenceAudio?: Array; + + /** + * An optional array of image references (up to 9). See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + references?: Array; + + /** + * An optional array of video references. The combined duration across all video + * references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on + * video inputs for more information. + */ + referenceVideos?: Array; + + /** + * The output resolution. Hailuo 3.0 supports 768P and 2K. + */ + resolution?: '2K' | '768P'; + } + + export namespace Hailuo3 { + /** + * An audio reference allows the model to use the audio as additional context for + * the output. + */ + export interface ReferenceAudio { + type: 'audio'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + uri: string; + } + + export interface Reference { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + uri: string; + } + + /** + * A video reference allows the model to use the video as additional context for + * the output. + */ + export interface ReferenceVideo { + type: 'video'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:video/mp4;base64,...`, up to 16MB) containing an encoded video. See + * [our docs](/assets/inputs#videos) on video inputs for more information. + */ + uri: string; + } + } + export interface Happyhorse1_0 { model: 'happyhorse_1_0'; @@ -225,8 +344,8 @@ export declare namespace TextToVideoCreateParams { | '2160:3840'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; @@ -323,8 +442,8 @@ export declare namespace TextToVideoCreateParams { | '720:1280'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; @@ -421,8 +540,8 @@ export declare namespace TextToVideoCreateParams { | '720:1280'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; @@ -501,29 +620,101 @@ export declare namespace TextToVideoCreateParams { ratio?: '1280:720' | '720:1280'; } - export interface Veo3 { + export interface Seedance2_5 { + model: 'seedance2_5'; + + /** + * Whether to generate audio for the video. + */ + audio?: boolean; + /** * The number of seconds of duration for the output video. */ - duration: 8; + duration?: number; - model: 'veo3'; + /** + * An optional text prompt up to 15000 characters describing what should appear in + * the output. + */ + promptText?: string; /** - * A non-empty string up to 1000 characters (measured in UTF-16 code units). This - * should describe in detail what should appear in the output. + * The resolution of the output video. Seedance 2.5 supports 480p and 720p only. */ - promptText: string; + ratio?: + | '992:432' + | '854:480' + | '752:560' + | '640:640' + | '560:752' + | '480:854' + | '1470:630' + | '1280:720' + | '1112:834' + | '960:960' + | '834:1112' + | '720:1280'; /** - * The resolution of the output video. + * An optional array of audio references. The total combined duration must be less + * than 30 seconds. */ - ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080'; + referenceAudio?: Array; /** - * Text describing what should not appear in the output video. + * An optional array of image references (up to 30). See + * [our docs](/assets/inputs#images) on image inputs for more information. */ - negativePrompt?: string; + references?: Array; + + /** + * An optional array of video references. The combined duration across all video + * references must not exceed 30 seconds. See [our docs](/assets/inputs#videos) on + * video inputs for more information. + */ + referenceVideos?: Array; + } + + export namespace Seedance2_5 { + /** + * An audio reference allows the model to use the audio as additional context for + * the output. + */ + export interface ReferenceAudio { + type: 'audio'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + uri: string; + } + + export interface Reference { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + uri: string; + } + + /** + * A video reference allows the model to use the video as additional context for + * the output. + */ + export interface ReferenceVideo { + type: 'video'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:video/mp4;base64,...`, up to 16MB) containing an encoded video. See + * [our docs](/assets/inputs#videos) on video inputs for more information. + */ + uri: string; + } } } diff --git a/src/resources/video-to-video.ts b/src/resources/video-to-video.ts index 1d1cb9f..6a5bc8f 100644 --- a/src/resources/video-to-video.ts +++ b/src/resources/video-to-video.ts @@ -34,14 +34,35 @@ export interface VideoToVideoCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: VideoToVideoCreateResponse.EstimatedCost; +} + +export namespace VideoToVideoCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export type VideoToVideoCreateParams = | VideoToVideoCreateParams.Variant0 + | VideoToVideoCreateParams.Hailuo3 | VideoToVideoCreateParams.Seedance2 | VideoToVideoCreateParams.Seedance2Fast | VideoToVideoCreateParams.Seedance2Mini - | VideoToVideoCreateParams.GeminiOmniFlash; + | VideoToVideoCreateParams.GeminiOmniFlash + | VideoToVideoCreateParams.Seedance2_5; export declare namespace VideoToVideoCreateParams { export interface Variant0 { @@ -65,11 +86,25 @@ export declare namespace VideoToVideoCreateParams { */ keyframes?: Array; + /** + * The container/encoding of the output. `mp4` (default) returns an H.264 .mp4. + * `prores` returns a ProRes .mov. `png_sequence` returns a .zip of PNG frames + * (plus a separate .wav artifact when the output has audio). Non-mp4 formats incur + * an additional surcharge of 5 credits per second of output. + */ + outputFormat?: 'mp4' | 'prores' | 'png_sequence'; + /** * A non-empty and optional string describing what should appear in the output. */ promptText?: string; + /** + * The ProRes profile to use. Only valid when `outputFormat` is `prores`. Defaults + * to `4444`. + */ + proresProfile?: '422' | '4444' | '422 Proxy' | '422 LT' | '422 HQ' | '4444 XQ'; + /** * @deprecated */ @@ -186,6 +221,98 @@ export declare namespace VideoToVideoCreateParams { } } + export interface Hailuo3 { + model: 'hailuo3'; + + /** + * A non-empty text prompt describing what should appear in the output. + */ + promptText: string; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:video/mp4;base64,...`, up to 16MB) containing an encoded video. See + * [our docs](/assets/inputs#videos) on video inputs for more information. + */ + promptVideo: string; + + /** + * The number of seconds of duration for the output video. + */ + duration?: number; + + /** + * The aspect ratio of the output video. Use adaptive only when image or video + * references are provided; text-only requests require a concrete ratio. + */ + ratio?: 'adaptive' | '21:9' | '16:9' | '4:3' | '1:1' | '3:4' | '9:16'; + + /** + * An optional array of audio references. Audio references require a text prompt, + * and the total combined duration must not exceed 15 seconds. + */ + referenceAudio?: Array; + + /** + * An optional array of image references (up to 9). See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + references?: Array; + + /** + * An optional array of video references. The combined duration across all video + * references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on + * video inputs for more information. + */ + referenceVideos?: Array; + + /** + * The output resolution. Hailuo 3.0 supports 768P and 2K. + */ + resolution?: '2K' | '768P'; + } + + export namespace Hailuo3 { + /** + * An audio reference allows the model to use the audio as additional context for + * the output. + */ + export interface ReferenceAudio { + type: 'audio'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + uri: string; + } + + export interface Reference { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + uri: string; + } + + /** + * A video reference allows the model to use the video as additional context for + * the output. + */ + export interface ReferenceVideo { + type: 'video'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:video/mp4;base64,...`, up to 16MB) containing an encoded video. See + * [our docs](/assets/inputs#videos) on video inputs for more information. + */ + uri: string; + } + } + export interface Seedance2 { model: 'seedance2'; @@ -242,8 +369,8 @@ export declare namespace VideoToVideoCreateParams { | '2160:3840'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; @@ -347,8 +474,8 @@ export declare namespace VideoToVideoCreateParams { | '720:1280'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; @@ -452,8 +579,8 @@ export declare namespace VideoToVideoCreateParams { | '720:1280'; /** - * An optional array of audio references. Audio references require a text prompt, - * and the total combined duration must not exceed 15 seconds. + * An optional array of audio references. The total combined duration must not + * exceed 15 seconds. */ referenceAudio?: Array; @@ -543,6 +670,118 @@ export declare namespace VideoToVideoCreateParams { uri: string; } } + + export interface Seedance2_5 { + model: 'seedance2_5'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:video/mp4;base64,...`, up to 16MB) containing an encoded video. See + * [our docs](/assets/inputs#videos) on video inputs for more information. + */ + promptVideo: string; + + /** + * Whether to generate audio for the video. + */ + audio?: boolean; + + /** + * The number of seconds of duration for the output video. Defaults to 5. + */ + duration?: number; + + /** + * How the input video is used. `reference` (the default) generates a new video + * conditioned on the input video and accepts `duration` and `ratio`. `extend` + * continues the input video, requires `promptText`, and matches the input aspect + * ratio, so `ratio` may not be provided. + */ + mode?: 'reference' | 'extend'; + + /** + * An optional text prompt up to 15000 characters describing what should appear in + * the output. + */ + promptText?: string; + + /** + * The resolution of the output video. Seedance 2.5 supports 480p and 720p only. + */ + ratio?: + | '992:432' + | '854:480' + | '752:560' + | '640:640' + | '560:752' + | '480:854' + | '1470:630' + | '1280:720' + | '1112:834' + | '960:960' + | '834:1112' + | '720:1280'; + + /** + * An optional array of audio references. The total combined duration must be less + * than 30 seconds. + */ + referenceAudio?: Array; + + /** + * An optional array of image references (up to 30). See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + references?: Array; + + /** + * An optional array of video references. The combined duration across all video + * references must not exceed 30 seconds. See [our docs](/assets/inputs#videos) on + * video inputs for more information. + */ + referenceVideos?: Array; + } + + export namespace Seedance2_5 { + /** + * An audio reference allows the model to use the audio as additional context for + * the output. + */ + export interface ReferenceAudio { + type: 'audio'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:audio/mp3;base64,...`, up to 16MB) containing an encoded audio. See + * [our docs](/assets/inputs#audio) on audio inputs for more information. + */ + uri: string; + } + + export interface Reference { + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:image/png;base64,...`, up to 5MB) containing an encoded image. See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + uri: string; + } + + /** + * A video reference allows the model to use the video as additional context for + * the output. + */ + export interface ReferenceVideo { + type: 'video'; + + /** + * A HTTPS URL, Runway upload URI, or base64 data URI (e.g. + * `data:video/mp4;base64,...`, up to 16MB) containing an encoded video. See + * [our docs](/assets/inputs#videos) on video inputs for more information. + */ + uri: string; + } + } } export declare namespace VideoToVideo { diff --git a/src/resources/video-upscale.ts b/src/resources/video-upscale.ts index 6dfb25b..bb08de7 100644 --- a/src/resources/video-upscale.ts +++ b/src/resources/video-upscale.ts @@ -32,6 +32,25 @@ export interface VideoUpscaleCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: VideoUpscaleCreateResponse.EstimatedCost; +} + +export namespace VideoUpscaleCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface VideoUpscaleCreateParams { diff --git a/src/resources/voice-dubbing.ts b/src/resources/voice-dubbing.ts index 4d45b58..3f820c7 100644 --- a/src/resources/voice-dubbing.ts +++ b/src/resources/voice-dubbing.ts @@ -35,6 +35,25 @@ export interface VoiceDubbingCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: VoiceDubbingCreateResponse.EstimatedCost; +} + +export namespace VoiceDubbingCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface VoiceDubbingCreateParams { diff --git a/src/resources/voice-isolation.ts b/src/resources/voice-isolation.ts index 04e5176..d702c4d 100644 --- a/src/resources/voice-isolation.ts +++ b/src/resources/voice-isolation.ts @@ -36,6 +36,25 @@ export interface VoiceIsolationCreateResponse { * The ID of the task that was created. Use this to retrieve the task later. */ id: string; + + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + estimatedCost: VoiceIsolationCreateResponse.EstimatedCost; +} + +export namespace VoiceIsolationCreateResponse { + /** + * The maximum credits this task may charge. The final amount may be lower after + * the task completes. + */ + export interface EstimatedCost { + /** + * Estimated cost of the generation in credits. + */ + credits: number; + } } export interface VoiceIsolationCreateParams { diff --git a/src/version.ts b/src/version.ts index f1be00c..ddc4bbe 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.13.2'; // x-release-please-version +export const VERSION = '4.14.0'; // x-release-please-version diff --git a/tests/api-resources/image-to-video.test.ts b/tests/api-resources/image-to-video.test.ts index 42dbb89..39e6c38 100644 --- a/tests/api-resources/image-to-video.test.ts +++ b/tests/api-resources/image-to-video.test.ts @@ -33,6 +33,8 @@ describe('resource imageToVideo', () => { promptText: 'x', ratio: '1280:720', contentModeration: { publicFigureThreshold: 'auto' }, + outputFormat: 'mp4', + proresProfile: '422', seed: 0, }); }); diff --git a/tests/api-resources/organization.test.ts b/tests/api-resources/organization/organization.test.ts similarity index 100% rename from tests/api-resources/organization.test.ts rename to tests/api-resources/organization/organization.test.ts diff --git a/tests/api-resources/organization/webapp/audit-logs.test.ts b/tests/api-resources/organization/webapp/audit-logs.test.ts new file mode 100644 index 0000000..c21257f --- /dev/null +++ b/tests/api-resources/organization/webapp/audit-logs.test.ts @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import RunwayML from '@runwayml/sdk'; + +const client = new RunwayML({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource auditLogs', () => { + test('retrieve', async () => { + const responsePromise = client.organization.webapp.auditLogs.retrieve( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('retrieve: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.organization.webapp.auditLogs.retrieve( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { organizationId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(RunwayML.NotFoundError); + }); + + test('list: only required params', async () => { + const responsePromise = client.organization.webapp.auditLogs.list({ limit: 1 }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.organization.webapp.auditLogs.list({ + limit: 1, + actions: 'actions', + actorEmails: 'actorEmails', + cursor: 'x', + from: '2019-12-27T18:11:19.117Z', + organizationId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + to: '2019-12-27T18:11:19.117Z', + workspaceIds: 'workspaceIds', + }); + }); +}); diff --git a/tests/api-resources/organization/webapp/webapp.test.ts b/tests/api-resources/organization/webapp/webapp.test.ts new file mode 100644 index 0000000..3d341e4 --- /dev/null +++ b/tests/api-resources/organization/webapp/webapp.test.ts @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import RunwayML from '@runwayml/sdk'; + +const client = new RunwayML({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource webapp', () => { + test('listUsage: only required params', async () => { + const responsePromise = client.organization.webapp.listUsage({ + from: '2019-12-27T18:11:19.117Z', + limit: 1, + to: '2019-12-27T18:11:19.117Z', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('listUsage: required and optional params', async () => { + const response = await client.organization.webapp.listUsage({ + from: '2019-12-27T18:11:19.117Z', + limit: 1, + to: '2019-12-27T18:11:19.117Z', + cursor: 'x', + organizationId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + workspaceIds: 'workspaceIds', + }); + }); +}); diff --git a/tests/api-resources/routers.test.ts b/tests/api-resources/routers.test.ts index 872f430..28563eb 100644 --- a/tests/api-resources/routers.test.ts +++ b/tests/api-resources/routers.test.ts @@ -25,6 +25,7 @@ describe('resource routers', () => { description: 'description', name: 'x', settings: { + fallback: { onCapacity: true }, maxCreditsPerGeneration: { audio: 1, image: 1, @@ -68,6 +69,7 @@ describe('resource routers', () => { description: 'description', name: 'x', settings: { + fallback: { onCapacity: true }, maxCreditsPerGeneration: { audio: 1, image: 1, @@ -108,4 +110,22 @@ describe('resource routers', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + test('listRequests: only required params', async () => { + const responsePromise = client.routers.listRequests('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { limit: 1 }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('listRequests: required and optional params', async () => { + const response = await client.routers.listRequests('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + limit: 1, + cursor: 'x', + }); + }); }); diff --git a/tests/api-resources/text-to-video.test.ts b/tests/api-resources/text-to-video.test.ts index 3d31686..669027f 100644 --- a/tests/api-resources/text-to-video.test.ts +++ b/tests/api-resources/text-to-video.test.ts @@ -31,6 +31,8 @@ describe('resource textToVideo', () => { promptText: 'x', ratio: '1280:720', contentModeration: { publicFigureThreshold: 'auto' }, + outputFormat: 'mp4', + proresProfile: '422', seed: 0, }); }); diff --git a/tests/api-resources/video-to-video.test.ts b/tests/api-resources/video-to-video.test.ts index 1b0539e..be591b7 100644 --- a/tests/api-resources/video-to-video.test.ts +++ b/tests/api-resources/video-to-video.test.ts @@ -34,7 +34,9 @@ describe('resource videoToVideo', () => { range: { end_seconds: 1, start_seconds: 0 }, }, ], + outputFormat: 'mp4', promptText: 'x', + proresProfile: '422', ratio: 'ratio', seed: 0, targetAspectRatio: '16:9',