@runapi.ai/imagen-4 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Imagen API JavaScript SDK for RunAPI
2
2
 
3
- The imagen api JavaScript SDK is the language-specific package for Imagen 4 on RunAPI. Use this imagen api package for text-to-image, image-to-image, edit, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
3
+ The imagen api JavaScript SDK is the language-specific package for Imagen 4 on RunAPI. Use this imagen api package for text-to-image, image editing, and creative production flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
4
 
5
5
  This imagen api README is the JavaScript package guide inside the public `imagen4-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/imagen-4; for API reference, use https://runapi.ai/docs#imagen-4; for SDK docs, use https://runapi.ai/docs#sdk-imagen-4.
6
6
 
@@ -24,6 +24,8 @@ const status = await client.generations.get(task.id);
24
24
 
25
25
  Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
26
26
 
27
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
28
+
27
29
  ## Language notes
28
30
 
29
31
  Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building image applications. The available resources include generations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
package/dist/index.d.mts CHANGED
@@ -1,67 +1,178 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
+ /** Text-to-image model variants differing by quality and latency. */
4
5
  type Imagen4TextModel = 'imagen-4' | 'imagen-4-fast' | 'imagen-4-ultra';
5
- type Imagen4Model = Imagen4TextModel | 'imagen-4-pro-image-to-image';
6
+ /** The remix model that accepts source images for guided generation. */
7
+ type Imagen4RemixModel = 'imagen-4-pro-remix-image';
8
+ /** Union of all Imagen 4 model identifiers. */
9
+ type Imagen4Model = Imagen4TextModel | Imagen4RemixModel;
10
+ /** Aspect ratios for text-to-image generation. */
6
11
  type TextAspectRatio = '1:1' | '16:9' | '9:16' | '3:4' | '4:3';
12
+ /** Extended aspect ratios for remix, including "auto" which infers from source images. */
7
13
  type ProAspectRatio = '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9' | 'auto';
8
- type Resolution = '1K' | '2K' | '4K';
14
+ /** Pixel resolution tier for remix output. */
15
+ type OutputResolution = '1k' | '2k' | '4k';
16
+ /** Image encoding format for remix output. */
9
17
  type OutputFormat = 'png' | 'jpg';
10
- type NumImages = '1' | '2' | '3' | '4';
18
+ /** Batch size for imagen-4-fast (the only model supporting multi-image output). */
19
+ type OutputCount = 1 | 2 | 3 | 4;
20
+ /**
21
+ * Parameters for imagen-4 (standard) and imagen-4-ultra (highest quality).
22
+ * These models produce a single image per request.
23
+ */
11
24
  interface BaseTextTextToImageParams {
12
25
  model: 'imagen-4' | 'imagen-4-ultra';
13
26
  prompt: string;
14
27
  callback_url?: string;
28
+ /** Content to steer the model away from in the output. */
15
29
  negative_prompt?: string;
16
30
  aspect_ratio?: TextAspectRatio;
17
- seed?: string | number;
31
+ /** Fixed seed for reproducible generation. */
32
+ seed?: number;
18
33
  }
34
+ /**
35
+ * Parameters for imagen-4-fast, which supports batch output (1-4 images)
36
+ * at lower latency than the standard tier.
37
+ */
19
38
  interface FastTextTextToImageParams {
20
39
  model: 'imagen-4-fast';
21
40
  prompt: string;
22
41
  callback_url?: string;
42
+ /** Content to steer the model away from in the output. */
23
43
  negative_prompt?: string;
24
44
  aspect_ratio?: TextAspectRatio;
25
- seed?: string | number;
26
- num_images?: NumImages;
45
+ /** Fixed seed for reproducible generation. */
46
+ seed?: number;
47
+ /** Number of images to generate (only supported by imagen-4-fast). */
48
+ output_count?: OutputCount;
27
49
  }
28
- interface ProImageToImageParams {
29
- model: 'imagen-4-pro-image-to-image';
50
+ /**
51
+ * Parameters for image remix -- guided generation from 1-8 source images
52
+ * combined with a text prompt. Supports resolution and format control.
53
+ */
54
+ interface RemixImageParams {
55
+ model: Imagen4RemixModel;
30
56
  prompt: string;
31
57
  callback_url?: string;
32
- image_input?: string[];
58
+ /** 1-8 publicly accessible source image URLs. */
59
+ source_image_urls: string[];
33
60
  aspect_ratio?: ProAspectRatio;
34
- resolution?: Resolution;
61
+ output_resolution?: OutputResolution;
35
62
  output_format?: OutputFormat;
36
63
  }
37
- type TextToImageParams = BaseTextTextToImageParams | FastTextTextToImageParams | ProImageToImageParams;
64
+ type TextToImageParams = BaseTextTextToImageParams | FastTextTextToImageParams;
38
65
  interface TaskCreateResponse {
39
66
  id: string;
40
67
  status: AsyncTaskStatus;
41
68
  }
69
+ /** A generated image with its CDN URL and optional unprocessed origin URL. */
70
+ interface Image {
71
+ url: string;
72
+ /** Unprocessed source URL when available (before CDN optimization). */
73
+ origin_url?: string;
74
+ }
42
75
  interface TextToImageResponse {
43
76
  id: string;
44
77
  status: AsyncTaskStatus;
45
- result_urls?: string[];
78
+ images?: Image[];
46
79
  error?: string;
47
80
  [key: string]: unknown;
48
81
  }
82
+ /**
83
+ * Resolved response returned by `run()` after polling sees `status: 'completed'`.
84
+ * Narrows the base response so `images` is guaranteed non-optional.
85
+ */
49
86
  type CompletedTextToImageResponse = TextToImageResponse & {
50
87
  status: 'completed';
51
- result_urls: string[];
88
+ images: Image[];
52
89
  };
90
+ type RemixImageResponse = TextToImageResponse;
91
+ type CompletedRemixImageResponse = CompletedTextToImageResponse;
53
92
 
93
+ /**
94
+ * Generates images from a text prompt.
95
+ * Three model tiers are available: imagen-4 (standard), imagen-4-fast (lower latency,
96
+ * batch output up to 4 images), and imagen-4-ultra (highest quality).
97
+ */
54
98
  declare class TextToImage {
55
99
  private readonly http;
56
100
  constructor(http: HttpClient);
101
+ /**
102
+ * Generate images from a text prompt and wait until complete.
103
+ * @param params Text-to-image parameters.
104
+ * @param options Per-request and polling overrides.
105
+ * @returns The completed task with images.
106
+ */
57
107
  run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<TextToImageResponse>;
108
+ /**
109
+ * Generate images from a text prompt; returns immediately with a task id.
110
+ * @param params Text-to-image parameters.
111
+ * @param options Per-request overrides.
112
+ * @returns The task creation result with id.
113
+ */
58
114
  create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
115
+ /**
116
+ * Fetch the current status of a text-to-image task.
117
+ * @param id The task id.
118
+ * @param options Per-request overrides.
119
+ * @returns The current text-to-image task status.
120
+ */
59
121
  get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
60
122
  }
61
123
 
62
- declare class Imagen4Client {
124
+ /**
125
+ * Generates new images guided by 1-8 source images combined with a text prompt.
126
+ * Supports output resolution control (1k/2k/4k) and format selection (png/jpg).
127
+ */
128
+ declare class RemixImage {
129
+ private readonly http;
130
+ constructor(http: HttpClient);
131
+ /**
132
+ * Transform source images guided by a text prompt and wait until complete.
133
+ * @param params Remix-image parameters.
134
+ * @param options Per-request and polling overrides.
135
+ * @returns The completed task with images.
136
+ */
137
+ run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<RemixImageResponse>;
138
+ /**
139
+ * Transform source images guided by a text prompt; returns immediately with a task id.
140
+ * @param params Remix-image parameters.
141
+ * @param options Per-request overrides.
142
+ * @returns The task creation result with id.
143
+ */
144
+ create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
145
+ /**
146
+ * Fetch the current status of a remix-image task.
147
+ * @param id The task id.
148
+ * @param options Per-request overrides.
149
+ * @returns The current remix-image task status.
150
+ */
151
+ get(id: string, options?: RequestOptions): Promise<RemixImageResponse>;
152
+ }
153
+
154
+ /**
155
+ * Imagen 4 image generation API client.
156
+ *
157
+ * Three text-to-image quality tiers (imagen-4, imagen-4-fast, imagen-4-ultra)
158
+ * and a dedicated remix model for guided image transformation from source images.
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const client = new Imagen4Client({ apiKey: 'your-api-key' });
163
+ *
164
+ * const result = await client.textToImage.run({
165
+ * model: 'imagen-4',
166
+ * prompt: 'A cat in a spacesuit on the moon',
167
+ * });
168
+ * ```
169
+ */
170
+ declare class Imagen4Client extends BaseClient {
171
+ /** Text-to-image generation across three quality tiers. */
63
172
  readonly textToImage: TextToImage;
173
+ /** Generate new images guided by one or more source images combined with a text prompt. */
174
+ readonly remixImage: RemixImage;
64
175
  constructor(options?: ClientOptions);
65
176
  }
66
177
 
67
- export { type BaseTextTextToImageParams, type CompletedTextToImageResponse, type FastTextTextToImageParams, Imagen4Client, type Imagen4Model, type Imagen4TextModel, type NumImages, type OutputFormat, type ProAspectRatio, type ProImageToImageParams, type Resolution, type TaskCreateResponse, type TextAspectRatio, TextToImage, type TextToImageParams, type TextToImageResponse };
178
+ export { type BaseTextTextToImageParams, type CompletedRemixImageResponse, type CompletedTextToImageResponse, type FastTextTextToImageParams, type Image, Imagen4Client, type Imagen4Model, type Imagen4RemixModel, type Imagen4TextModel, type OutputCount, type OutputFormat, type OutputResolution, type ProAspectRatio, RemixImage, type RemixImageParams, type RemixImageResponse, type TaskCreateResponse, type TextAspectRatio, TextToImage, type TextToImageParams, type TextToImageResponse };
package/dist/index.d.ts CHANGED
@@ -1,67 +1,178 @@
1
- import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
+ /** Text-to-image model variants differing by quality and latency. */
4
5
  type Imagen4TextModel = 'imagen-4' | 'imagen-4-fast' | 'imagen-4-ultra';
5
- type Imagen4Model = Imagen4TextModel | 'imagen-4-pro-image-to-image';
6
+ /** The remix model that accepts source images for guided generation. */
7
+ type Imagen4RemixModel = 'imagen-4-pro-remix-image';
8
+ /** Union of all Imagen 4 model identifiers. */
9
+ type Imagen4Model = Imagen4TextModel | Imagen4RemixModel;
10
+ /** Aspect ratios for text-to-image generation. */
6
11
  type TextAspectRatio = '1:1' | '16:9' | '9:16' | '3:4' | '4:3';
12
+ /** Extended aspect ratios for remix, including "auto" which infers from source images. */
7
13
  type ProAspectRatio = '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9' | 'auto';
8
- type Resolution = '1K' | '2K' | '4K';
14
+ /** Pixel resolution tier for remix output. */
15
+ type OutputResolution = '1k' | '2k' | '4k';
16
+ /** Image encoding format for remix output. */
9
17
  type OutputFormat = 'png' | 'jpg';
10
- type NumImages = '1' | '2' | '3' | '4';
18
+ /** Batch size for imagen-4-fast (the only model supporting multi-image output). */
19
+ type OutputCount = 1 | 2 | 3 | 4;
20
+ /**
21
+ * Parameters for imagen-4 (standard) and imagen-4-ultra (highest quality).
22
+ * These models produce a single image per request.
23
+ */
11
24
  interface BaseTextTextToImageParams {
12
25
  model: 'imagen-4' | 'imagen-4-ultra';
13
26
  prompt: string;
14
27
  callback_url?: string;
28
+ /** Content to steer the model away from in the output. */
15
29
  negative_prompt?: string;
16
30
  aspect_ratio?: TextAspectRatio;
17
- seed?: string | number;
31
+ /** Fixed seed for reproducible generation. */
32
+ seed?: number;
18
33
  }
34
+ /**
35
+ * Parameters for imagen-4-fast, which supports batch output (1-4 images)
36
+ * at lower latency than the standard tier.
37
+ */
19
38
  interface FastTextTextToImageParams {
20
39
  model: 'imagen-4-fast';
21
40
  prompt: string;
22
41
  callback_url?: string;
42
+ /** Content to steer the model away from in the output. */
23
43
  negative_prompt?: string;
24
44
  aspect_ratio?: TextAspectRatio;
25
- seed?: string | number;
26
- num_images?: NumImages;
45
+ /** Fixed seed for reproducible generation. */
46
+ seed?: number;
47
+ /** Number of images to generate (only supported by imagen-4-fast). */
48
+ output_count?: OutputCount;
27
49
  }
28
- interface ProImageToImageParams {
29
- model: 'imagen-4-pro-image-to-image';
50
+ /**
51
+ * Parameters for image remix -- guided generation from 1-8 source images
52
+ * combined with a text prompt. Supports resolution and format control.
53
+ */
54
+ interface RemixImageParams {
55
+ model: Imagen4RemixModel;
30
56
  prompt: string;
31
57
  callback_url?: string;
32
- image_input?: string[];
58
+ /** 1-8 publicly accessible source image URLs. */
59
+ source_image_urls: string[];
33
60
  aspect_ratio?: ProAspectRatio;
34
- resolution?: Resolution;
61
+ output_resolution?: OutputResolution;
35
62
  output_format?: OutputFormat;
36
63
  }
37
- type TextToImageParams = BaseTextTextToImageParams | FastTextTextToImageParams | ProImageToImageParams;
64
+ type TextToImageParams = BaseTextTextToImageParams | FastTextTextToImageParams;
38
65
  interface TaskCreateResponse {
39
66
  id: string;
40
67
  status: AsyncTaskStatus;
41
68
  }
69
+ /** A generated image with its CDN URL and optional unprocessed origin URL. */
70
+ interface Image {
71
+ url: string;
72
+ /** Unprocessed source URL when available (before CDN optimization). */
73
+ origin_url?: string;
74
+ }
42
75
  interface TextToImageResponse {
43
76
  id: string;
44
77
  status: AsyncTaskStatus;
45
- result_urls?: string[];
78
+ images?: Image[];
46
79
  error?: string;
47
80
  [key: string]: unknown;
48
81
  }
82
+ /**
83
+ * Resolved response returned by `run()` after polling sees `status: 'completed'`.
84
+ * Narrows the base response so `images` is guaranteed non-optional.
85
+ */
49
86
  type CompletedTextToImageResponse = TextToImageResponse & {
50
87
  status: 'completed';
51
- result_urls: string[];
88
+ images: Image[];
52
89
  };
90
+ type RemixImageResponse = TextToImageResponse;
91
+ type CompletedRemixImageResponse = CompletedTextToImageResponse;
53
92
 
93
+ /**
94
+ * Generates images from a text prompt.
95
+ * Three model tiers are available: imagen-4 (standard), imagen-4-fast (lower latency,
96
+ * batch output up to 4 images), and imagen-4-ultra (highest quality).
97
+ */
54
98
  declare class TextToImage {
55
99
  private readonly http;
56
100
  constructor(http: HttpClient);
101
+ /**
102
+ * Generate images from a text prompt and wait until complete.
103
+ * @param params Text-to-image parameters.
104
+ * @param options Per-request and polling overrides.
105
+ * @returns The completed task with images.
106
+ */
57
107
  run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<TextToImageResponse>;
108
+ /**
109
+ * Generate images from a text prompt; returns immediately with a task id.
110
+ * @param params Text-to-image parameters.
111
+ * @param options Per-request overrides.
112
+ * @returns The task creation result with id.
113
+ */
58
114
  create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
115
+ /**
116
+ * Fetch the current status of a text-to-image task.
117
+ * @param id The task id.
118
+ * @param options Per-request overrides.
119
+ * @returns The current text-to-image task status.
120
+ */
59
121
  get(id: string, options?: RequestOptions): Promise<TextToImageResponse>;
60
122
  }
61
123
 
62
- declare class Imagen4Client {
124
+ /**
125
+ * Generates new images guided by 1-8 source images combined with a text prompt.
126
+ * Supports output resolution control (1k/2k/4k) and format selection (png/jpg).
127
+ */
128
+ declare class RemixImage {
129
+ private readonly http;
130
+ constructor(http: HttpClient);
131
+ /**
132
+ * Transform source images guided by a text prompt and wait until complete.
133
+ * @param params Remix-image parameters.
134
+ * @param options Per-request and polling overrides.
135
+ * @returns The completed task with images.
136
+ */
137
+ run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<RemixImageResponse>;
138
+ /**
139
+ * Transform source images guided by a text prompt; returns immediately with a task id.
140
+ * @param params Remix-image parameters.
141
+ * @param options Per-request overrides.
142
+ * @returns The task creation result with id.
143
+ */
144
+ create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse>;
145
+ /**
146
+ * Fetch the current status of a remix-image task.
147
+ * @param id The task id.
148
+ * @param options Per-request overrides.
149
+ * @returns The current remix-image task status.
150
+ */
151
+ get(id: string, options?: RequestOptions): Promise<RemixImageResponse>;
152
+ }
153
+
154
+ /**
155
+ * Imagen 4 image generation API client.
156
+ *
157
+ * Three text-to-image quality tiers (imagen-4, imagen-4-fast, imagen-4-ultra)
158
+ * and a dedicated remix model for guided image transformation from source images.
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * const client = new Imagen4Client({ apiKey: 'your-api-key' });
163
+ *
164
+ * const result = await client.textToImage.run({
165
+ * model: 'imagen-4',
166
+ * prompt: 'A cat in a spacesuit on the moon',
167
+ * });
168
+ * ```
169
+ */
170
+ declare class Imagen4Client extends BaseClient {
171
+ /** Text-to-image generation across three quality tiers. */
63
172
  readonly textToImage: TextToImage;
173
+ /** Generate new images guided by one or more source images combined with a text prompt. */
174
+ readonly remixImage: RemixImage;
64
175
  constructor(options?: ClientOptions);
65
176
  }
66
177
 
67
- export { type BaseTextTextToImageParams, type CompletedTextToImageResponse, type FastTextTextToImageParams, Imagen4Client, type Imagen4Model, type Imagen4TextModel, type NumImages, type OutputFormat, type ProAspectRatio, type ProImageToImageParams, type Resolution, type TaskCreateResponse, type TextAspectRatio, TextToImage, type TextToImageParams, type TextToImageResponse };
178
+ export { type BaseTextTextToImageParams, type CompletedRemixImageResponse, type CompletedTextToImageResponse, type FastTextTextToImageParams, type Image, Imagen4Client, type Imagen4Model, type Imagen4RemixModel, type Imagen4TextModel, type OutputCount, type OutputFormat, type OutputResolution, type ProAspectRatio, RemixImage, type RemixImageParams, type RemixImageResponse, type TaskCreateResponse, type TextAspectRatio, TextToImage, type TextToImageParams, type TextToImageResponse };
package/dist/index.js CHANGED
@@ -20,24 +20,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- AuthenticationError: () => import_core3.AuthenticationError,
23
+ AuthenticationError: () => import_core4.AuthenticationError,
24
24
  Imagen4Client: () => Imagen4Client,
25
- InsufficientCreditsError: () => import_core3.InsufficientCreditsError,
26
- NetworkError: () => import_core3.NetworkError,
27
- NotFoundError: () => import_core3.NotFoundError,
28
- RateLimitError: () => import_core3.RateLimitError,
29
- RunApiError: () => import_core3.RunApiError,
30
- ServiceUnavailableError: () => import_core3.ServiceUnavailableError,
31
- TaskFailedError: () => import_core3.TaskFailedError,
32
- TaskTimeoutError: () => import_core3.TaskTimeoutError,
25
+ InsufficientCreditsError: () => import_core4.InsufficientCreditsError,
26
+ NetworkError: () => import_core4.NetworkError,
27
+ NotFoundError: () => import_core4.NotFoundError,
28
+ RateLimitError: () => import_core4.RateLimitError,
29
+ RemixImage: () => RemixImage,
30
+ RunApiError: () => import_core4.RunApiError,
31
+ ServiceUnavailableError: () => import_core4.ServiceUnavailableError,
32
+ TaskFailedError: () => import_core4.TaskFailedError,
33
+ TaskTimeoutError: () => import_core4.TaskTimeoutError,
33
34
  TextToImage: () => TextToImage,
34
- TimeoutError: () => import_core3.TimeoutError,
35
- ValidationError: () => import_core3.ValidationError
35
+ TimeoutError: () => import_core4.TimeoutError,
36
+ ValidationError: () => import_core4.ValidationError
36
37
  });
37
38
  module.exports = __toCommonJS(index_exports);
38
39
 
39
40
  // src/client.ts
40
- var import_core2 = require("@runapi.ai/core");
41
+ var import_core3 = require("@runapi.ai/core");
41
42
 
42
43
  // src/resources/text-to-image.ts
43
44
  var import_core = require("@runapi.ai/core");
@@ -48,6 +49,12 @@ var TextToImage = class {
48
49
  this.http = http;
49
50
  }
50
51
  http;
52
+ /**
53
+ * Generate images from a text prompt and wait until complete.
54
+ * @param params Text-to-image parameters.
55
+ * @param options Per-request and polling overrides.
56
+ * @returns The completed task with images.
57
+ */
51
58
  async run(params, options) {
52
59
  const { id } = await this.create(params, options);
53
60
  return (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
@@ -55,12 +62,24 @@ var TextToImage = class {
55
62
  pollIntervalMs: options?.pollIntervalMs
56
63
  });
57
64
  }
65
+ /**
66
+ * Generate images from a text prompt; returns immediately with a task id.
67
+ * @param params Text-to-image parameters.
68
+ * @param options Per-request overrides.
69
+ * @returns The task creation result with id.
70
+ */
58
71
  async create(params, options) {
59
72
  return this.http.request("POST", ENDPOINT, {
60
73
  body: (0, import_core.compactParams)(params),
61
74
  ...options
62
75
  });
63
76
  }
77
+ /**
78
+ * Fetch the current status of a text-to-image task.
79
+ * @param id The task id.
80
+ * @param options Per-request overrides.
81
+ * @returns The current text-to-image task status.
82
+ */
64
83
  async get(id, options) {
65
84
  return this.http.request("GET", `${ENDPOINT}/${id}`, {
66
85
  ...options
@@ -68,17 +87,68 @@ var TextToImage = class {
68
87
  }
69
88
  };
70
89
 
90
+ // src/resources/remix-image.ts
91
+ var import_core2 = require("@runapi.ai/core");
92
+ var import_internal2 = require("@runapi.ai/core/internal");
93
+ var ENDPOINT2 = "/api/v1/imagen_4/remix_image";
94
+ var RemixImage = class {
95
+ constructor(http) {
96
+ this.http = http;
97
+ }
98
+ http;
99
+ /**
100
+ * Transform source images guided by a text prompt and wait until complete.
101
+ * @param params Remix-image parameters.
102
+ * @param options Per-request and polling overrides.
103
+ * @returns The completed task with images.
104
+ */
105
+ async run(params, options) {
106
+ const { id } = await this.create(params, options);
107
+ return (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
108
+ maxWaitMs: options?.maxWaitMs,
109
+ pollIntervalMs: options?.pollIntervalMs
110
+ });
111
+ }
112
+ /**
113
+ * Transform source images guided by a text prompt; returns immediately with a task id.
114
+ * @param params Remix-image parameters.
115
+ * @param options Per-request overrides.
116
+ * @returns The task creation result with id.
117
+ */
118
+ async create(params, options) {
119
+ return this.http.request("POST", ENDPOINT2, {
120
+ body: (0, import_core2.compactParams)(params),
121
+ ...options
122
+ });
123
+ }
124
+ /**
125
+ * Fetch the current status of a remix-image task.
126
+ * @param id The task id.
127
+ * @param options Per-request overrides.
128
+ * @returns The current remix-image task status.
129
+ */
130
+ async get(id, options) {
131
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, {
132
+ ...options
133
+ });
134
+ }
135
+ };
136
+
71
137
  // src/client.ts
72
- var Imagen4Client = class {
138
+ var Imagen4Client = class extends import_core3.BaseClient {
139
+ /** Text-to-image generation across three quality tiers. */
73
140
  textToImage;
141
+ /** Generate new images guided by one or more source images combined with a text prompt. */
142
+ remixImage;
74
143
  constructor(options = {}) {
75
- const http = (0, import_core2.createHttpClient)(options);
76
- this.textToImage = new TextToImage(http);
144
+ super(options);
145
+ this.textToImage = new TextToImage(this.http);
146
+ this.remixImage = new RemixImage(this.http);
77
147
  }
78
148
  };
79
149
 
80
150
  // src/index.ts
81
- var import_core3 = require("@runapi.ai/core");
151
+ var import_core4 = require("@runapi.ai/core");
82
152
  // Annotate the CommonJS export names for ESM import in node:
83
153
  0 && (module.exports = {
84
154
  AuthenticationError,
@@ -87,6 +157,7 @@ var import_core3 = require("@runapi.ai/core");
87
157
  NetworkError,
88
158
  NotFoundError,
89
159
  RateLimitError,
160
+ RemixImage,
90
161
  RunApiError,
91
162
  ServiceUnavailableError,
92
163
  TaskFailedError,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts"],"sourcesContent":["export { Imagen4Client } from './client';\nexport { TextToImage } from './resources/text-to-image';\nexport type * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\n\nexport class Imagen4Client {\n public readonly textToImage: TextToImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { TextToImageParams, TextToImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/imagen_4/text_to_image';\n\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<TextToImageResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAAqD;;;ACCrD,kBAA8B;AAC9B,sBAAkC;AAGlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,IAAI,QAA2B,SAAyE;AAC5G,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,eAAO,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzE,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AD3BO,IAAM,gBAAN,MAAoB;AAAA,EACT;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,WAAO,+BAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AAAA,EACzC;AACF;;;ADNA,IAAAC,eAYO;","names":["import_core","import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/resources/remix-image.ts"],"sourcesContent":["export { Imagen4Client } from './client';\nexport { TextToImage } from './resources/text-to-image';\nexport { RemixImage } from './resources/remix-image';\nexport type * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { RemixImage } from './resources/remix-image';\n\n/**\n * Imagen 4 image generation API client.\n *\n * Three text-to-image quality tiers (imagen-4, imagen-4-fast, imagen-4-ultra)\n * and a dedicated remix model for guided image transformation from source images.\n *\n * @example\n * ```typescript\n * const client = new Imagen4Client({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToImage.run({\n * model: 'imagen-4',\n * prompt: 'A cat in a spacesuit on the moon',\n * });\n * ```\n */\nexport class Imagen4Client extends BaseClient {\n /** Text-to-image generation across three quality tiers. */\n public readonly textToImage: TextToImage;\n /** Generate new images guided by one or more source images combined with a text prompt. */\n public readonly remixImage: RemixImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.remixImage = new RemixImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { TextToImageParams, TextToImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/imagen_4/text_to_image';\n\n/**\n * Generates images from a text prompt.\n * Three model tiers are available: imagen-4 (standard), imagen-4-fast (lower latency,\n * batch output up to 4 images), and imagen-4-ultra (highest quality).\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate images from a text prompt and wait until complete.\n * @param params Text-to-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with images.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<TextToImageResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n /**\n * Generate images from a text prompt; returns immediately with a task id.\n * @param params Text-to-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { RemixImageParams, RemixImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/imagen_4/remix_image';\n\n/**\n * Generates new images guided by 1-8 source images combined with a text prompt.\n * Supports output resolution control (1k/2k/4k) and format selection (png/jpg).\n */\nexport class RemixImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Transform source images guided by a text prompt and wait until complete.\n * @param params Remix-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with images.\n */\n async run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<RemixImageResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<RemixImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n /**\n * Transform source images guided by a text prompt; returns immediately with a task id.\n * @param params Remix-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a remix-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current remix-image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<RemixImageResponse> {\n return this.http.request<RemixImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8B;AAC9B,sBAAkC;AAGlC,IAAM,WAAW;AAOV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAyE;AAC5G,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,eAAO,mCAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzE,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACpDA,IAAAC,eAA8B;AAC9B,IAAAC,mBAAkC;AAGlC,IAAMC,YAAW;AAMV,IAAM,aAAN,MAAiB;AAAA,EACtB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA0B,SAAwE;AAC1G,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,eAAO,oCAAsC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACxE,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA0B,SAAuD;AAC5F,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D,UAAM,4BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAuD;AAC3E,WAAO,KAAK,KAAK,QAA4B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACvE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,gBAAN,cAA4B,wBAAW;AAAA;AAAA,EAE5B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,aAAa,IAAI,WAAW,KAAK,IAAI;AAAA,EAC5C;AACF;;;AD1BA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/client.ts
2
- import { createHttpClient } from "@runapi.ai/core";
2
+ import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-image.ts
5
5
  import { compactParams } from "@runapi.ai/core";
@@ -10,6 +10,12 @@ var TextToImage = class {
10
10
  this.http = http;
11
11
  }
12
12
  http;
13
+ /**
14
+ * Generate images from a text prompt and wait until complete.
15
+ * @param params Text-to-image parameters.
16
+ * @param options Per-request and polling overrides.
17
+ * @returns The completed task with images.
18
+ */
13
19
  async run(params, options) {
14
20
  const { id } = await this.create(params, options);
15
21
  return pollUntilComplete(() => this.get(id, options), {
@@ -17,12 +23,24 @@ var TextToImage = class {
17
23
  pollIntervalMs: options?.pollIntervalMs
18
24
  });
19
25
  }
26
+ /**
27
+ * Generate images from a text prompt; returns immediately with a task id.
28
+ * @param params Text-to-image parameters.
29
+ * @param options Per-request overrides.
30
+ * @returns The task creation result with id.
31
+ */
20
32
  async create(params, options) {
21
33
  return this.http.request("POST", ENDPOINT, {
22
34
  body: compactParams(params),
23
35
  ...options
24
36
  });
25
37
  }
38
+ /**
39
+ * Fetch the current status of a text-to-image task.
40
+ * @param id The task id.
41
+ * @param options Per-request overrides.
42
+ * @returns The current text-to-image task status.
43
+ */
26
44
  async get(id, options) {
27
45
  return this.http.request("GET", `${ENDPOINT}/${id}`, {
28
46
  ...options
@@ -30,12 +48,63 @@ var TextToImage = class {
30
48
  }
31
49
  };
32
50
 
51
+ // src/resources/remix-image.ts
52
+ import { compactParams as compactParams2 } from "@runapi.ai/core";
53
+ import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
54
+ var ENDPOINT2 = "/api/v1/imagen_4/remix_image";
55
+ var RemixImage = class {
56
+ constructor(http) {
57
+ this.http = http;
58
+ }
59
+ http;
60
+ /**
61
+ * Transform source images guided by a text prompt and wait until complete.
62
+ * @param params Remix-image parameters.
63
+ * @param options Per-request and polling overrides.
64
+ * @returns The completed task with images.
65
+ */
66
+ async run(params, options) {
67
+ const { id } = await this.create(params, options);
68
+ return pollUntilComplete2(() => this.get(id, options), {
69
+ maxWaitMs: options?.maxWaitMs,
70
+ pollIntervalMs: options?.pollIntervalMs
71
+ });
72
+ }
73
+ /**
74
+ * Transform source images guided by a text prompt; returns immediately with a task id.
75
+ * @param params Remix-image parameters.
76
+ * @param options Per-request overrides.
77
+ * @returns The task creation result with id.
78
+ */
79
+ async create(params, options) {
80
+ return this.http.request("POST", ENDPOINT2, {
81
+ body: compactParams2(params),
82
+ ...options
83
+ });
84
+ }
85
+ /**
86
+ * Fetch the current status of a remix-image task.
87
+ * @param id The task id.
88
+ * @param options Per-request overrides.
89
+ * @returns The current remix-image task status.
90
+ */
91
+ async get(id, options) {
92
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, {
93
+ ...options
94
+ });
95
+ }
96
+ };
97
+
33
98
  // src/client.ts
34
- var Imagen4Client = class {
99
+ var Imagen4Client = class extends BaseClient {
100
+ /** Text-to-image generation across three quality tiers. */
35
101
  textToImage;
102
+ /** Generate new images guided by one or more source images combined with a text prompt. */
103
+ remixImage;
36
104
  constructor(options = {}) {
37
- const http = createHttpClient(options);
38
- this.textToImage = new TextToImage(http);
105
+ super(options);
106
+ this.textToImage = new TextToImage(this.http);
107
+ this.remixImage = new RemixImage(this.http);
39
108
  }
40
109
  };
41
110
 
@@ -60,6 +129,7 @@ export {
60
129
  NetworkError,
61
130
  NotFoundError,
62
131
  RateLimitError,
132
+ RemixImage,
63
133
  RunApiError,
64
134
  ServiceUnavailableError,
65
135
  TaskFailedError,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/index.ts"],"sourcesContent":["import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\n\nexport class Imagen4Client {\n public readonly textToImage: TextToImage;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToImage = new TextToImage(http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { TextToImageParams, TextToImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/imagen_4/text_to_image';\n\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<TextToImageResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { Imagen4Client } from './client';\nexport { TextToImage } from './resources/text-to-image';\nexport type * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,wBAA4C;;;ACCrD,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAGlC,IAAM,WAAW;AAEV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,IAAI,QAA2B,SAAyE;AAC5G,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,WAAO,kBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzE,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AD3BO,IAAM,gBAAN,MAAoB;AAAA,EACT;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO,iBAAiB,OAAO;AACrC,SAAK,cAAc,IAAI,YAAY,IAAI;AAAA,EACzC;AACF;;;AENA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/resources/remix-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { RemixImage } from './resources/remix-image';\n\n/**\n * Imagen 4 image generation API client.\n *\n * Three text-to-image quality tiers (imagen-4, imagen-4-fast, imagen-4-ultra)\n * and a dedicated remix model for guided image transformation from source images.\n *\n * @example\n * ```typescript\n * const client = new Imagen4Client({ apiKey: 'your-api-key' });\n *\n * const result = await client.textToImage.run({\n * model: 'imagen-4',\n * prompt: 'A cat in a spacesuit on the moon',\n * });\n * ```\n */\nexport class Imagen4Client extends BaseClient {\n /** Text-to-image generation across three quality tiers. */\n public readonly textToImage: TextToImage;\n /** Generate new images guided by one or more source images combined with a text prompt. */\n public readonly remixImage: RemixImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.remixImage = new RemixImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { TextToImageParams, TextToImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/imagen_4/text_to_image';\n\n/**\n * Generates images from a text prompt.\n * Three model tiers are available: imagen-4 (standard), imagen-4-fast (lower latency,\n * batch output up to 4 images), and imagen-4-ultra (highest quality).\n */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate images from a text prompt and wait until complete.\n * @param params Text-to-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with images.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<TextToImageResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n /**\n * Generate images from a text prompt; returns immediately with a task id.\n * @param params Text-to-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToImageResponse> {\n return this.http.request<TextToImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { RemixImageParams, RemixImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/imagen_4/remix_image';\n\n/**\n * Generates new images guided by 1-8 source images combined with a text prompt.\n * Supports output resolution control (1k/2k/4k) and format selection (png/jpg).\n */\nexport class RemixImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Transform source images guided by a text prompt and wait until complete.\n * @param params Remix-image parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed task with images.\n */\n async run(params: RemixImageParams, options?: RequestOptions & PollingOptions): Promise<RemixImageResponse> {\n const { id } = await this.create(params, options);\n return pollUntilComplete<RemixImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n }\n\n /**\n * Transform source images guided by a text prompt; returns immediately with a task id.\n * @param params Remix-image parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: RemixImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a remix-image task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current remix-image task status.\n */\n async get(id: string, options?: RequestOptions): Promise<RemixImageResponse> {\n return this.http.request<RemixImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { Imagen4Client } from './client';\nexport { TextToImage } from './resources/text-to-image';\nexport { RemixImage } from './resources/remix-image';\nexport type * from './types';\n\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAGlC,IAAM,WAAW;AAOV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAyE;AAC5G,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,WAAO,kBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzE,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACpDA,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,qBAAAC,0BAAyB;AAGlC,IAAMC,YAAW;AAMV,IAAM,aAAN,MAAiB;AAAA,EACtB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA0B,SAAwE;AAC1G,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,WAAOD,mBAAsC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACxE,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA0B,SAAuD;AAC5F,WAAO,KAAK,KAAK,QAA4B,QAAQC,WAAU;AAAA,MAC7D,MAAMF,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAuD;AAC3E,WAAO,KAAK,KAAK,QAA4B,OAAO,GAAGE,SAAQ,IAAI,EAAE,IAAI;AAAA,MACvE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AFhCO,IAAM,gBAAN,cAA4B,WAAW;AAAA;AAAA,EAE5B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,aAAa,IAAI,WAAW,KAAK,IAAI;AAAA,EAC5C;AACF;;;AG1BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","pollUntilComplete","ENDPOINT"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runapi.ai/imagen-4",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "RunAPI Imagen 4 SDK for JavaScript, Ruby, and Go",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -27,7 +27,7 @@
27
27
  "clean": "rm -rf dist"
28
28
  },
29
29
  "dependencies": {
30
- "@runapi.ai/core": "^0.2.4"
30
+ "@runapi.ai/core": "^0.2.6"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.0.0",