diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 112b0ef..544a78b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.21.1" + ".": "3.22.0" } diff --git a/.stats.yml b/.stats.yml index a2303a1..b6b14bc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml/runwayml-ed8d0c17e291217781d37e1e60b969f2950d2fedaa182d41d80aac9945d1ff85.yml -openapi_spec_hash: 083b5c74652bfd7ba82748e1c04f8bc2 -config_hash: 3063a17ad98d447287f6f7eab9d6d1d6 +configured_endpoints: 38 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml/runwayml-cfb6e42f50c5de798cb44d95bb8e1e0b378a1cad932b937b249aca35136c7758.yml +openapi_spec_hash: 2d2bb8ab56561238e5415dbbd3e4d725 +config_hash: 6d8ca402de13857362ee587c404baca9 diff --git a/CHANGELOG.md b/CHANGELOG.md index ec9cf33..b0d4b90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 3.22.0 (2026-06-02) + +Full Changelog: [v3.21.1...v3.22.0](https://github.com/runwayml/sdk-node/compare/v3.21.1...v3.22.0) + +### Features + +* **api:** Aleph2 ([d05ce4d](https://github.com/runwayml/sdk-node/commit/d05ce4dcfe8d92a730c4a2ce75f93541c252a03f)) +* **api:** Image upscale endpoint ([5ffa7b9](https://github.com/runwayml/sdk-node/commit/5ffa7b980e2e06db13579915d515e15bed637b3b)) + + +### Bug Fixes + +* **client:** Awaitable task output on image upscale ([d07cebf](https://github.com/runwayml/sdk-node/commit/d07cebf8ba10d9324043eb4f087a703c2fb01a69)) + ## 3.21.1 (2026-05-27) Full Changelog: [v3.21.0...v3.21.1](https://github.com/runwayml/sdk-node/compare/v3.21.0...v3.21.1) diff --git a/api.md b/api.md index b7c7532..1fa3343 100644 --- a/api.md +++ b/api.md @@ -109,6 +109,16 @@ Methods: - client.speechToSpeech.create({ ...params }) -> SpeechToSpeechCreateResponse +# ImageUpscale + +Types: + +- ImageUpscaleCreateResponse + +Methods: + +- client.imageUpscale.create({ ...params }) -> ImageUpscaleCreateResponse + # Organization Types: diff --git a/package.json b/package.json index 222c459..4fe0d29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@runwayml/sdk", - "version": "3.21.1", + "version": "3.22.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 2b0afd2..f6bb77f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -51,6 +51,11 @@ import { ImageToVideoCreateParams, ImageToVideoCreateResponse, } from './resources/image-to-video'; +import { + ImageUpscale, + ImageUpscaleCreateParams, + ImageUpscaleCreateResponse, +} from './resources/image-upscale'; import { Organization, OrganizationRetrieveResponse, @@ -908,6 +913,10 @@ export class RunwayML { * These endpoints all kick off tasks to create generations. */ speechToSpeech: API.SpeechToSpeech = new API.SpeechToSpeech(this); + /** + * These endpoints all kick off tasks to create generations. + */ + imageUpscale: API.ImageUpscale = new API.ImageUpscale(this); organization: API.Organization = new API.Organization(this); avatars: API.Avatars = new API.Avatars(this); avatarVideos: API.AvatarVideos = new API.AvatarVideos(this); @@ -930,6 +939,7 @@ RunwayML.SoundEffect = SoundEffect; RunwayML.VoiceIsolation = VoiceIsolation; RunwayML.VoiceDubbing = VoiceDubbing; RunwayML.SpeechToSpeech = SpeechToSpeech; +RunwayML.ImageUpscale = ImageUpscale; RunwayML.Organization = Organization; RunwayML.Avatars = Avatars; RunwayML.AvatarVideos = AvatarVideos; @@ -1008,6 +1018,12 @@ export declare namespace RunwayML { type SpeechToSpeechCreateParams as SpeechToSpeechCreateParams, }; + export { + ImageUpscale as ImageUpscale, + type ImageUpscaleCreateResponse as ImageUpscaleCreateResponse, + type ImageUpscaleCreateParams as ImageUpscaleCreateParams, + }; + export { Organization as Organization, type OrganizationRetrieveResponse as OrganizationRetrieveResponse, diff --git a/src/resources/image-upscale.ts b/src/resources/image-upscale.ts new file mode 100644 index 0000000..eb0749f --- /dev/null +++ b/src/resources/image-upscale.ts @@ -0,0 +1,83 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { RequestOptions } from '../internal/request-options'; +import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../lib/polling'; + +/** + * These endpoints all kick off tasks to create generations. + */ +export class ImageUpscale extends APIResource { + /** + * Upscale an image with Magnific precision upscaling. Each input dimension must be + * between 300px and 8000px. Output width and height are the input dimensions + * multiplied by `scaleFactor` (default 2). Output width times height cannot exceed + * 25,300,000 pixels (~25.3 million). + * + * @example + * ```ts + * const imageUpscale = await client.imageUpscale.create({ + * imageUri: 'https://example.com/image.jpg', + * model: 'magnific_precision_upscaler_v2', + * }); + * ``` + */ + create( + body: ImageUpscaleCreateParams, + options?: RequestOptions, + ): APIPromiseWithAwaitableTask { + return wrapAsWaitableResource(this._client)( + this._client.post('/v1/image_upscale', { body, ...options }), + ); + } +} + +export interface ImageUpscaleCreateResponse { + /** + * The ID of the task that was created. Use this to retrieve the task later. + */ + id: string; +} + +export interface ImageUpscaleCreateParams { + /** + * A HTTPS URL. + */ + imageUri: string; + + model: 'magnific_precision_upscaler_v2'; + + /** + * Optimization preset: `sublime` (illustration), `photo` (photographic), or + * `photo_denoiser` (noisy photos). + */ + flavor?: 'sublime' | 'photo' | 'photo_denoiser'; + + /** + * Multiplies each input dimension to produce output width and height. Defaults + * to 2. + */ + scaleFactor?: 2 | 4 | 8 | 16; + + /** + * Sharpness intensity from 0 (none) to 100. + */ + sharpen?: number; + + /** + * Grain and texture enhancement from 0 to 100. + */ + smartGrain?: number; + + /** + * Fine detail enhancement from 0 to 100. + */ + ultraDetail?: number; +} + +export declare namespace ImageUpscale { + export { + type ImageUpscaleCreateResponse as ImageUpscaleCreateResponse, + type ImageUpscaleCreateParams as ImageUpscaleCreateParams, + }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index 40c2ee8..867cba2 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -32,6 +32,11 @@ export { type ImageToVideoCreateResponse, type ImageToVideoCreateParams, } from './image-to-video'; +export { + ImageUpscale, + type ImageUpscaleCreateResponse, + type ImageUpscaleCreateParams, +} from './image-upscale'; export { Organization, type OrganizationRetrieveResponse, diff --git a/src/resources/organization.ts b/src/resources/organization.ts index 896a0e3..f057259 100644 --- a/src/resources/organization.ts +++ b/src/resources/organization.ts @@ -127,6 +127,16 @@ export interface OrganizationRetrieveUsageResponse { | 'gwm1_avatar_async_text_to_video' | 'voice_processing' | 'seedance2' + | 'magnific_precision_upscaler_v2' + | 'kling2.5_turbo_pro' + | 'kling3.0_pro' + | 'kling3.0_4k' + | 'kling3.0_standard' + | 'klingO3_pro' + | 'klingO3_standard' + | 'klingO3_4k' + | 'happyhorse_1_0' + | 'aleph2' >; results: Array; @@ -183,7 +193,17 @@ export namespace OrganizationRetrieveUsageResponse { | 'gwm1_avatar_async_audio_to_video' | 'gwm1_avatar_async_text_to_video' | 'voice_processing' - | 'seedance2'; + | 'seedance2' + | 'magnific_precision_upscaler_v2' + | 'kling2.5_turbo_pro' + | 'kling3.0_pro' + | 'kling3.0_4k' + | 'kling3.0_standard' + | 'klingO3_pro' + | 'klingO3_standard' + | 'klingO3_4k' + | 'happyhorse_1_0' + | 'aleph2'; } } } diff --git a/src/resources/text-to-image.ts b/src/resources/text-to-image.ts index 20e97f2..d19e1e2 100644 --- a/src/resources/text-to-image.ts +++ b/src/resources/text-to-image.ts @@ -33,6 +33,7 @@ export type TextToImageCreateParams = | TextToImageCreateParams.Gen4Image | TextToImageCreateParams.GptImage2 | TextToImageCreateParams.GeminiImage3Pro + | TextToImageCreateParams.GeminiImage3_1Flash | TextToImageCreateParams.Gemini2_5Flash; export declare namespace TextToImageCreateParams { @@ -352,6 +353,114 @@ export declare namespace TextToImageCreateParams { } } + export interface GeminiImage3_1Flash { + model: 'gemini_image3.1_flash'; + + /** + * 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. + */ + promptText: string; + + /** + * The resolution of the output image. + */ + ratio: + | '512:512' + | '416:624' + | '624:416' + | '432:592' + | '592:432' + | '448:576' + | '576:448' + | '384:672' + | '672:384' + | '768:336' + | '256:1024' + | '1024:256' + | '176:1408' + | '1408:176' + | '1024:1024' + | '832:1248' + | '1248:832' + | '864:1184' + | '1184:864' + | '896:1152' + | '1152:896' + | '768:1344' + | '1344:768' + | '1536:672' + | '512:2048' + | '2048:512' + | '352:2816' + | '2816:352' + | '2048:2048' + | '1696:2528' + | '2528:1696' + | '1792:2400' + | '2400:1792' + | '1856:2304' + | '2304:1856' + | '1536:2752' + | '2752:1536' + | '3168:1344' + | '1024:4096' + | '4096:1024' + | '704:5632' + | '5632:704' + | '4096:4096' + | '3392:5056' + | '5056:3392' + | '3584:4800' + | '4800:3584' + | '3712:4608' + | '4608:3712' + | '3072:5504' + | '5504:3072' + | '6336:2688' + | '2048:8192' + | '8192:2048' + | '1408:11264' + | '11264:1408'; + + /** + * The number of images to generate. Increasing this number will affect the number + * of credits consumed by the generation. Up to four images can be generated at + * once. + */ + outputCount?: 1 | 4; + + /** + * An array of up to 14 images to be used as references for the generated image + * output. Up to five of those images can pass `subject: "human"` to maintain + * character consistency, and up to nine of those images can pass + * `subject: "object"` with high-fidelity images of objects to include in the + * output. + */ + referenceImages?: Array; + } + + export namespace GeminiImage3_1Flash { + export interface ReferenceImage { + /** + * A HTTPS URL. + */ + uri: string; + + /** + * Whether this is a reference of a human subject (for character consistency) or an + * object that appears in the output. + */ + subject?: 'object' | 'human'; + + /** + * A tag to identify the reference image. This is used to reference the image in + * prompt text. + */ + tag?: string; + } + } + export interface Gemini2_5Flash { model: 'gemini_2.5_flash'; diff --git a/src/resources/video-to-video.ts b/src/resources/video-to-video.ts index 947bc11..3af2973 100644 --- a/src/resources/video-to-video.ts +++ b/src/resources/video-to-video.ts @@ -37,68 +37,192 @@ export interface VideoToVideoCreateResponse { id: string; } -export interface VideoToVideoCreateParams { - model: 'gen4_aleph'; +export type VideoToVideoCreateParams = VideoToVideoCreateParams.Gen4Aleph | VideoToVideoCreateParams.Aleph2; - /** - * 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. - */ - promptText: string; +export declare namespace VideoToVideoCreateParams { + export interface Gen4Aleph { + model: 'gen4_aleph'; - /** - * A HTTPS URL. - */ - videoUri: 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. + */ + promptText: string; - /** - * Settings that affect the behavior of the content moderation system. - */ - contentModeration?: VideoToVideoCreateParams.ContentModeration; + /** + * A HTTPS URL. + */ + videoUri: string; - /** - * @deprecated Deprecated. This field is ignored. The resolution of the output - * video is determined by the input video. - */ - ratio?: '1280:720' | '720:1280' | '1104:832' | '960:960' | '832:1104' | '1584:672' | '848:480' | '640:480'; + /** + * Settings that affect the behavior of the content moderation system. + */ + contentModeration?: Gen4Aleph.ContentModeration; - /** - * An array of references. Currently up to one reference is supported. See - * [our docs](/assets/inputs#images) on image inputs for more information. - */ - references?: Array; + /** + * @deprecated Deprecated. This field is ignored. The resolution of the output + * video is determined by the input video. + */ + ratio?: + | '1280:720' + | '720:1280' + | '1104:832' + | '960:960' + | '832:1104' + | '1584:672' + | '848:480' + | '640:480'; - /** - * 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 - * integer for an identical request will produce similar results. - */ - seed?: number; -} + /** + * An array of references. Currently up to one reference is supported. See + * [our docs](/assets/inputs#images) on image inputs for more information. + */ + references?: Array; -export namespace VideoToVideoCreateParams { - /** - * Settings that affect the behavior of the content moderation system. - */ - export interface ContentModeration { /** - * When set to `low`, the content moderation system will be less strict about - * preventing generations that include recognizable public figures. + * 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 + * integer for an identical request will produce similar results. */ - publicFigureThreshold?: 'auto' | 'low'; + seed?: number; } - /** - * Passing an image reference allows the model to emulate the style or content of - * the reference in the output. - */ - export interface Reference { - type: 'image'; + export namespace Gen4Aleph { + /** + * Settings that affect the behavior of the content moderation system. + */ + export interface ContentModeration { + /** + * When set to `low`, the content moderation system will be less strict about + * preventing generations that include recognizable public figures. + */ + publicFigureThreshold?: 'auto' | 'low'; + } + + /** + * Passing an image reference allows the model to emulate the style or content of + * the reference in the output. + */ + export interface Reference { + type: 'image'; + + /** + * A HTTPS URL. + */ + uri: string; + } + } + + export interface Aleph2 { + model: 'aleph2'; + + /** + * A non-empty string up to 1000 characters describing what should appear in the + * output. + */ + promptText: string; /** * A HTTPS URL. */ - uri: string; + videoUri: string; + + /** + * Settings that affect the behavior of the content moderation system. + */ + contentModeration?: Aleph2.ContentModeration; + + /** + * Timed guidance images placed at specific points in the input video. Up to 5 + * keyframes. + */ + keyframes?: Array; + + /** + * A list of up to 5 image keyframes for guiding the edit at specific points in the + * video. + */ + promptImage?: Array; + + /** + * 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 + * integer for an identical request will produce similar results. + */ + seed?: number; + } + + export namespace Aleph2 { + /** + * Settings that affect the behavior of the content moderation system. + */ + export interface ContentModeration { + /** + * When set to `low`, the content moderation system will be less strict about + * preventing generations that include recognizable public figures. + */ + publicFigureThreshold?: 'auto' | 'low'; + } + + export interface UnionMember0 { + /** + * Absolute timestamp in seconds from the start of the input video when this + * guidance image should apply. + */ + seconds: number; + + /** + * A HTTPS URL. + */ + uri: string; + } + + export interface UnionMember1 { + /** + * Position as a fraction [0.0, 1.0] of the input video duration when this guidance + * image should apply. + */ + at: number; + + /** + * A HTTPS URL. + */ + uri: string; + } + + export interface PromptImage { + /** + * - `first` - Places the image at the start of the output video (timestamp 0). + * - `last` - Places the image at the end of the output video (timestamp = + * duration). + */ + position: 'first' | 'last' | PromptImage.TimestampPosition | PromptImage.RelativePosition; + + /** + * A HTTPS URL. + */ + uri: string; + } + + export namespace PromptImage { + export interface TimestampPosition { + /** + * Absolute timestamp in seconds from the start of the output video. + */ + timestampSeconds: number; + + type: 'timestamp'; + } + + export interface RelativePosition { + /** + * Position as a fraction [0.0, 1.0] of the total video duration. + */ + positionPercentage: number; + + type: 'position'; + } + } } } diff --git a/src/version.ts b/src/version.ts index e65dc34..688b9af 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '3.21.1'; // x-release-please-version +export const VERSION = '3.22.0'; // x-release-please-version diff --git a/tests/api-resources/image-upscale.test.ts b/tests/api-resources/image-upscale.test.ts new file mode 100644 index 0000000..338715b --- /dev/null +++ b/tests/api-resources/image-upscale.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 imageUpscale', () => { + test('create: only required params', async () => { + const responsePromise = client.imageUpscale.create({ + imageUri: 'https://example.com/image.jpg', + model: 'magnific_precision_upscaler_v2', + }); + 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('create: required and optional params', async () => { + const response = await client.imageUpscale.create({ + imageUri: 'https://example.com/image.jpg', + model: 'magnific_precision_upscaler_v2', + flavor: 'sublime', + scaleFactor: 2, + sharpen: 0, + smartGrain: 0, + ultraDetail: 0, + }); + }); +});