@runapi.ai/nano-banana 0.2.9 → 0.2.10
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/dist/index.d.mts +30 -14
- package/dist/index.d.ts +30 -14
- package/dist/index.js +48 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundEr
|
|
|
3
3
|
|
|
4
4
|
/** Generation model tiers: standard (fast), pro (higher resolution + more refs), v2, and v2 lite. */
|
|
5
5
|
type TextToImageModel = 'nano-banana' | 'nano-banana-pro' | 'nano-banana-2' | 'nano-banana-2-lite';
|
|
6
|
-
/**
|
|
7
|
-
type EditImageModel = 'nano-banana-edit';
|
|
6
|
+
/** Editing-capable Nano Banana models. */
|
|
7
|
+
type EditImageModel = 'nano-banana-edit' | 'nano-banana-2-lite';
|
|
8
8
|
/** Aspect ratio options for the standard model. */
|
|
9
9
|
type BaseAspectRatio = '1:1' | '9:16' | '16:9' | '3:4' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '21:9' | 'auto';
|
|
10
10
|
/** Aspect ratio options for the pro model. */
|
|
@@ -18,6 +18,8 @@ type AspectRatioV2 = AspectRatio | '1:4' | '1:8' | '4:1' | '8:1';
|
|
|
18
18
|
type OutputResolution = '1k' | '2k' | '4k';
|
|
19
19
|
/** Output image encoding format. */
|
|
20
20
|
type OutputFormat = 'png' | 'jpg' | 'jpeg';
|
|
21
|
+
/** Output image encoding format for the dedicated edit model. */
|
|
22
|
+
type EditOutputFormat = 'png' | 'jpeg';
|
|
21
23
|
/** Standard tier generation. Up to 8 reference images, max 5000-char prompt. */
|
|
22
24
|
interface GenerationBaseParams {
|
|
23
25
|
model: 'nano-banana';
|
|
@@ -52,7 +54,8 @@ interface GenerationV2Params {
|
|
|
52
54
|
}
|
|
53
55
|
/** V2 Lite generation. Requires aspect_ratio, accepts up to 10 references, and has no output format or resolution controls. */
|
|
54
56
|
interface GenerationV2LiteParams {
|
|
55
|
-
|
|
57
|
+
/** Defaults to `nano-banana-2-lite` when omitted. */
|
|
58
|
+
model?: 'nano-banana-2-lite';
|
|
56
59
|
prompt: string;
|
|
57
60
|
callback_url?: string;
|
|
58
61
|
aspect_ratio: AspectRatioV2;
|
|
@@ -64,20 +67,34 @@ interface GenerationV2LiteParams {
|
|
|
64
67
|
* aspect ratios, prompt length, resolution, and reference image count differ per tier.
|
|
65
68
|
*/
|
|
66
69
|
type TextToImageParams = GenerationBaseParams | GenerationProParams | GenerationV2Params | GenerationV2LiteParams;
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
* Up to 10 source images, max 10 MB each.
|
|
70
|
-
*/
|
|
71
|
-
interface EditImageParams {
|
|
70
|
+
/** Dedicated edit model. Requires source images and supports output format control. */
|
|
71
|
+
interface EditImageBaseParams {
|
|
72
72
|
model: 'nano-banana-edit';
|
|
73
73
|
/** Edit instruction describing the desired changes (up to 5000 chars). */
|
|
74
74
|
prompt: string;
|
|
75
75
|
/** Source images to edit (up to 10 images, max 10 MB each). */
|
|
76
76
|
source_image_urls: string[];
|
|
77
77
|
callback_url?: string;
|
|
78
|
-
output_format?:
|
|
78
|
+
output_format?: EditOutputFormat;
|
|
79
79
|
aspect_ratio?: BaseAspectRatio;
|
|
80
80
|
}
|
|
81
|
+
/** V2 Lite edit. Requires aspect_ratio and does not accept output_format. */
|
|
82
|
+
interface EditImageV2LiteParams {
|
|
83
|
+
/** Defaults to `nano-banana-2-lite` when omitted. */
|
|
84
|
+
model?: 'nano-banana-2-lite';
|
|
85
|
+
/** Edit instruction describing the desired changes (up to 20000 chars). */
|
|
86
|
+
prompt: string;
|
|
87
|
+
/** Source images to edit (up to 10 images). */
|
|
88
|
+
source_image_urls: string[];
|
|
89
|
+
callback_url?: string;
|
|
90
|
+
aspect_ratio: AspectRatioV2;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Edit image parameters. A discriminated union on `model`: the dedicated edit
|
|
94
|
+
* model supports output format, while V2 Lite requires aspect ratio and omits
|
|
95
|
+
* output format controls.
|
|
96
|
+
*/
|
|
97
|
+
type EditImageParams = EditImageBaseParams | EditImageV2LiteParams;
|
|
81
98
|
interface TaskCreateResponse {
|
|
82
99
|
id: string;
|
|
83
100
|
}
|
|
@@ -154,7 +171,7 @@ declare class EditImage {
|
|
|
154
171
|
private readonly http;
|
|
155
172
|
constructor(http: HttpClient);
|
|
156
173
|
/**
|
|
157
|
-
* Edit an image using text prompts and
|
|
174
|
+
* Edit an image using text prompts and source images and wait until complete.
|
|
158
175
|
* @param params Edit parameters.
|
|
159
176
|
* @param options Per-request and polling overrides.
|
|
160
177
|
* @returns The completed edit with image results.
|
|
@@ -179,9 +196,8 @@ declare class EditImage {
|
|
|
179
196
|
/**
|
|
180
197
|
* NanoBanana image generation and editing API client.
|
|
181
198
|
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* reference images). Editing uses the dedicated `nano-banana-edit` model.
|
|
199
|
+
* Generation tiers include standard, pro, v2, and v2 lite. Image editing
|
|
200
|
+
* supports `nano-banana-2-lite` and the dedicated `nano-banana-edit` model.
|
|
185
201
|
*
|
|
186
202
|
* @example
|
|
187
203
|
* ```typescript
|
|
@@ -204,4 +220,4 @@ declare class NanoBananaClient extends BaseClient {
|
|
|
204
220
|
constructor(options?: ClientOptions);
|
|
205
221
|
}
|
|
206
222
|
|
|
207
|
-
export { type AspectRatio, type AspectRatioV2, type BaseAspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type GenerationBaseParams, type GenerationProParams, type GenerationV2LiteParams, type GenerationV2Params, type Image, NanoBananaClient, type OutputFormat, type OutputResolution, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse };
|
|
223
|
+
export { type AspectRatio, type AspectRatioV2, type BaseAspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageBaseParams, type EditImageModel, type EditImageParams, type EditImageResponse, type EditImageV2LiteParams, type EditOutputFormat, type GenerationBaseParams, type GenerationProParams, type GenerationV2LiteParams, type GenerationV2Params, type Image, NanoBananaClient, type OutputFormat, type OutputResolution, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundEr
|
|
|
3
3
|
|
|
4
4
|
/** Generation model tiers: standard (fast), pro (higher resolution + more refs), v2, and v2 lite. */
|
|
5
5
|
type TextToImageModel = 'nano-banana' | 'nano-banana-pro' | 'nano-banana-2' | 'nano-banana-2-lite';
|
|
6
|
-
/**
|
|
7
|
-
type EditImageModel = 'nano-banana-edit';
|
|
6
|
+
/** Editing-capable Nano Banana models. */
|
|
7
|
+
type EditImageModel = 'nano-banana-edit' | 'nano-banana-2-lite';
|
|
8
8
|
/** Aspect ratio options for the standard model. */
|
|
9
9
|
type BaseAspectRatio = '1:1' | '9:16' | '16:9' | '3:4' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '21:9' | 'auto';
|
|
10
10
|
/** Aspect ratio options for the pro model. */
|
|
@@ -18,6 +18,8 @@ type AspectRatioV2 = AspectRatio | '1:4' | '1:8' | '4:1' | '8:1';
|
|
|
18
18
|
type OutputResolution = '1k' | '2k' | '4k';
|
|
19
19
|
/** Output image encoding format. */
|
|
20
20
|
type OutputFormat = 'png' | 'jpg' | 'jpeg';
|
|
21
|
+
/** Output image encoding format for the dedicated edit model. */
|
|
22
|
+
type EditOutputFormat = 'png' | 'jpeg';
|
|
21
23
|
/** Standard tier generation. Up to 8 reference images, max 5000-char prompt. */
|
|
22
24
|
interface GenerationBaseParams {
|
|
23
25
|
model: 'nano-banana';
|
|
@@ -52,7 +54,8 @@ interface GenerationV2Params {
|
|
|
52
54
|
}
|
|
53
55
|
/** V2 Lite generation. Requires aspect_ratio, accepts up to 10 references, and has no output format or resolution controls. */
|
|
54
56
|
interface GenerationV2LiteParams {
|
|
55
|
-
|
|
57
|
+
/** Defaults to `nano-banana-2-lite` when omitted. */
|
|
58
|
+
model?: 'nano-banana-2-lite';
|
|
56
59
|
prompt: string;
|
|
57
60
|
callback_url?: string;
|
|
58
61
|
aspect_ratio: AspectRatioV2;
|
|
@@ -64,20 +67,34 @@ interface GenerationV2LiteParams {
|
|
|
64
67
|
* aspect ratios, prompt length, resolution, and reference image count differ per tier.
|
|
65
68
|
*/
|
|
66
69
|
type TextToImageParams = GenerationBaseParams | GenerationProParams | GenerationV2Params | GenerationV2LiteParams;
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
* Up to 10 source images, max 10 MB each.
|
|
70
|
-
*/
|
|
71
|
-
interface EditImageParams {
|
|
70
|
+
/** Dedicated edit model. Requires source images and supports output format control. */
|
|
71
|
+
interface EditImageBaseParams {
|
|
72
72
|
model: 'nano-banana-edit';
|
|
73
73
|
/** Edit instruction describing the desired changes (up to 5000 chars). */
|
|
74
74
|
prompt: string;
|
|
75
75
|
/** Source images to edit (up to 10 images, max 10 MB each). */
|
|
76
76
|
source_image_urls: string[];
|
|
77
77
|
callback_url?: string;
|
|
78
|
-
output_format?:
|
|
78
|
+
output_format?: EditOutputFormat;
|
|
79
79
|
aspect_ratio?: BaseAspectRatio;
|
|
80
80
|
}
|
|
81
|
+
/** V2 Lite edit. Requires aspect_ratio and does not accept output_format. */
|
|
82
|
+
interface EditImageV2LiteParams {
|
|
83
|
+
/** Defaults to `nano-banana-2-lite` when omitted. */
|
|
84
|
+
model?: 'nano-banana-2-lite';
|
|
85
|
+
/** Edit instruction describing the desired changes (up to 20000 chars). */
|
|
86
|
+
prompt: string;
|
|
87
|
+
/** Source images to edit (up to 10 images). */
|
|
88
|
+
source_image_urls: string[];
|
|
89
|
+
callback_url?: string;
|
|
90
|
+
aspect_ratio: AspectRatioV2;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Edit image parameters. A discriminated union on `model`: the dedicated edit
|
|
94
|
+
* model supports output format, while V2 Lite requires aspect ratio and omits
|
|
95
|
+
* output format controls.
|
|
96
|
+
*/
|
|
97
|
+
type EditImageParams = EditImageBaseParams | EditImageV2LiteParams;
|
|
81
98
|
interface TaskCreateResponse {
|
|
82
99
|
id: string;
|
|
83
100
|
}
|
|
@@ -154,7 +171,7 @@ declare class EditImage {
|
|
|
154
171
|
private readonly http;
|
|
155
172
|
constructor(http: HttpClient);
|
|
156
173
|
/**
|
|
157
|
-
* Edit an image using text prompts and
|
|
174
|
+
* Edit an image using text prompts and source images and wait until complete.
|
|
158
175
|
* @param params Edit parameters.
|
|
159
176
|
* @param options Per-request and polling overrides.
|
|
160
177
|
* @returns The completed edit with image results.
|
|
@@ -179,9 +196,8 @@ declare class EditImage {
|
|
|
179
196
|
/**
|
|
180
197
|
* NanoBanana image generation and editing API client.
|
|
181
198
|
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* reference images). Editing uses the dedicated `nano-banana-edit` model.
|
|
199
|
+
* Generation tiers include standard, pro, v2, and v2 lite. Image editing
|
|
200
|
+
* supports `nano-banana-2-lite` and the dedicated `nano-banana-edit` model.
|
|
185
201
|
*
|
|
186
202
|
* @example
|
|
187
203
|
* ```typescript
|
|
@@ -204,4 +220,4 @@ declare class NanoBananaClient extends BaseClient {
|
|
|
204
220
|
constructor(options?: ClientOptions);
|
|
205
221
|
}
|
|
206
222
|
|
|
207
|
-
export { type AspectRatio, type AspectRatioV2, type BaseAspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type GenerationBaseParams, type GenerationProParams, type GenerationV2LiteParams, type GenerationV2Params, type Image, NanoBananaClient, type OutputFormat, type OutputResolution, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse };
|
|
223
|
+
export { type AspectRatio, type AspectRatioV2, type BaseAspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageBaseParams, type EditImageModel, type EditImageParams, type EditImageResponse, type EditImageV2LiteParams, type EditOutputFormat, type GenerationBaseParams, type GenerationProParams, type GenerationV2LiteParams, type GenerationV2Params, type Image, NanoBananaClient, type OutputFormat, type OutputResolution, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse };
|
package/dist/index.js
CHANGED
|
@@ -46,9 +46,41 @@ var import_internal = require("@runapi.ai/core/internal");
|
|
|
46
46
|
var contract = {
|
|
47
47
|
"edit-image": {
|
|
48
48
|
"models": [
|
|
49
|
+
"nano-banana-2-lite",
|
|
49
50
|
"nano-banana-edit"
|
|
50
51
|
],
|
|
51
52
|
"fields_by_model": {
|
|
53
|
+
"nano-banana-2-lite": {
|
|
54
|
+
"aspect_ratio": {
|
|
55
|
+
"enum": [
|
|
56
|
+
"1:1",
|
|
57
|
+
"1:4",
|
|
58
|
+
"1:8",
|
|
59
|
+
"2:3",
|
|
60
|
+
"3:2",
|
|
61
|
+
"3:4",
|
|
62
|
+
"4:1",
|
|
63
|
+
"4:3",
|
|
64
|
+
"4:5",
|
|
65
|
+
"5:4",
|
|
66
|
+
"8:1",
|
|
67
|
+
"9:16",
|
|
68
|
+
"16:9",
|
|
69
|
+
"21:9",
|
|
70
|
+
"auto"
|
|
71
|
+
],
|
|
72
|
+
"required": true
|
|
73
|
+
},
|
|
74
|
+
"prompt": {
|
|
75
|
+
"required": true,
|
|
76
|
+
"min": 1,
|
|
77
|
+
"max": 2e4,
|
|
78
|
+
"length": true
|
|
79
|
+
},
|
|
80
|
+
"source_image_urls": {
|
|
81
|
+
"required": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
52
84
|
"nano-banana-edit": {
|
|
53
85
|
"aspect_ratio": {
|
|
54
86
|
"enum": [
|
|
@@ -75,7 +107,17 @@ var contract = {
|
|
|
75
107
|
"required": true
|
|
76
108
|
}
|
|
77
109
|
}
|
|
78
|
-
}
|
|
110
|
+
},
|
|
111
|
+
"rules": [
|
|
112
|
+
{
|
|
113
|
+
"when": {
|
|
114
|
+
"model": "nano-banana-2-lite"
|
|
115
|
+
},
|
|
116
|
+
"forbidden": [
|
|
117
|
+
"output_format"
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
79
121
|
},
|
|
80
122
|
"text-to-image": {
|
|
81
123
|
"models": [
|
|
@@ -220,6 +262,7 @@ var contract = {
|
|
|
220
262
|
|
|
221
263
|
// src/resources/text-to-image.ts
|
|
222
264
|
var ENDPOINT = "/api/v1/nano_banana/text_to_image";
|
|
265
|
+
var DEFAULT_MODEL = "nano-banana-2-lite";
|
|
223
266
|
var TextToImage = class {
|
|
224
267
|
constructor(http) {
|
|
225
268
|
this.http = http;
|
|
@@ -246,7 +289,7 @@ var TextToImage = class {
|
|
|
246
289
|
* @returns The task creation result with id.
|
|
247
290
|
*/
|
|
248
291
|
async create(params, options) {
|
|
249
|
-
const body = (0, import_core.compactParams)(params);
|
|
292
|
+
const body = { model: DEFAULT_MODEL, ...(0, import_core.compactParams)(params) };
|
|
250
293
|
(0, import_core.validateParams)(contract["text-to-image"], body);
|
|
251
294
|
return this.http.request("POST", ENDPOINT, {
|
|
252
295
|
body,
|
|
@@ -270,13 +313,14 @@ var TextToImage = class {
|
|
|
270
313
|
var import_core2 = require("@runapi.ai/core");
|
|
271
314
|
var import_internal2 = require("@runapi.ai/core/internal");
|
|
272
315
|
var ENDPOINT2 = "/api/v1/nano_banana/edit_image";
|
|
316
|
+
var DEFAULT_MODEL2 = "nano-banana-2-lite";
|
|
273
317
|
var EditImage = class {
|
|
274
318
|
constructor(http) {
|
|
275
319
|
this.http = http;
|
|
276
320
|
}
|
|
277
321
|
http;
|
|
278
322
|
/**
|
|
279
|
-
* Edit an image using text prompts and
|
|
323
|
+
* Edit an image using text prompts and source images and wait until complete.
|
|
280
324
|
* @param params Edit parameters.
|
|
281
325
|
* @param options Per-request and polling overrides.
|
|
282
326
|
* @returns The completed edit with image results.
|
|
@@ -296,7 +340,7 @@ var EditImage = class {
|
|
|
296
340
|
* @returns The task creation result with id.
|
|
297
341
|
*/
|
|
298
342
|
async create(params, options) {
|
|
299
|
-
const body = (0, import_core2.compactParams)(params);
|
|
343
|
+
const body = { model: DEFAULT_MODEL2, ...(0, import_core2.compactParams)(params) };
|
|
300
344
|
(0, import_core2.validateParams)(contract["edit-image"], body);
|
|
301
345
|
return this.http.request("POST", ENDPOINT2, {
|
|
302
346
|
body,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts"],"sourcesContent":["export { NanoBananaClient } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\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 { EditImage } from './resources/edit-image';\n\n/**\n * NanoBanana image generation and editing API client.\n *\n * Three generation tiers: standard (fast), pro (higher resolution, more\n * reference images), and v2 (longest prompts, extreme aspect ratios, up to 14\n * reference images). Editing uses the dedicated `nano-banana-edit` model.\n *\n * @example\n * ```typescript\n * const client = new NanoBananaClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'nano-banana-pro',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class NanoBananaClient extends BaseClient {\n /** Generate images from text prompts with optional reference image guidance. */\n public readonly textToImage: TextToImage;\n /** Edit existing images using text prompts and source images. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/text_to_image';\n\n/** Generates images from text prompts with optional reference image guidance. Model tier controls prompt length, resolution, and reference image limits. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image from a text prompt and wait until complete.\n * @param params Generation parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed generation with image results.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create an image generation task; returns immediately with a task id.\n * @param params Generation 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 const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image generation task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image generation 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","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"nano-banana-edit\"\n ],\n \"fields_by_model\": {\n \"nano-banana-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"source_image_urls\": {\n \"required\": true\n }\n }\n }\n },\n \"text-to-image\": {\n \"models\": [\n \"nano-banana\",\n \"nano-banana-2\",\n \"nano-banana-2-lite\",\n \"nano-banana-pro\"\n ],\n \"fields_by_model\": {\n \"nano-banana\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n }\n },\n \"nano-banana-2\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n },\n \"nano-banana-2-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 1,\n \"max\": 20000,\n \"length\": true\n }\n },\n \"nano-banana-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"nano-banana-2-lite\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type { CompletedEditImageResponse, EditImageParams, EditImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/edit_image';\n\n/** Modifies existing images based on text prompts. Requires source images to edit. */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Edit an image using text prompts and reference images and wait until complete.\n * @param params Edit parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit with image results.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an image edit task; returns immediately with a task id.\n * @param params Edit parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image edit task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image edit task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('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;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;AAC9C,sBAAkC;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,oBAAoB;AAAA,QAClB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,eAAe;AAAA,QACb,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,MACF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GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,UAAM,oCAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,UAAM,WAAO,4BAAc,MAAM;AACjC,qCAAe,SAAS,YAAY,GAAmB,IAA+B;AACtF,WAAO,KAAK,KAAK,QAA4B,QAAQA,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AH7BO,IAAM,mBAAN,cAA+B,wBAAW;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AD/BA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts"],"sourcesContent":["export { NanoBananaClient } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\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 { EditImage } from './resources/edit-image';\n\n/**\n * NanoBanana image generation and editing API client.\n *\n * Generation tiers include standard, pro, v2, and v2 lite. Image editing\n * supports `nano-banana-2-lite` and the dedicated `nano-banana-edit` model.\n *\n * @example\n * ```typescript\n * const client = new NanoBananaClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'nano-banana-pro',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class NanoBananaClient extends BaseClient {\n /** Generate images from text prompts with optional reference image guidance. */\n public readonly textToImage: TextToImage;\n /** Edit existing images using text prompts and source images. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/text_to_image';\nconst DEFAULT_MODEL = 'nano-banana-2-lite';\n\n/** Generates images from text prompts with optional reference image guidance. Model tier controls prompt length, resolution, and reference image limits. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image from a text prompt and wait until complete.\n * @param params Generation parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed generation with image results.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create an image generation task; returns immediately with a task id.\n * @param params Generation 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 const body = { model: DEFAULT_MODEL, ...compactParams(params) };\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image generation task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image generation 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","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"nano-banana-2-lite\",\n \"nano-banana-edit\"\n ],\n \"fields_by_model\": {\n \"nano-banana-2-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 1,\n \"max\": 20000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true\n }\n },\n \"nano-banana-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"source_image_urls\": {\n \"required\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"nano-banana-2-lite\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n }\n ]\n },\n \"text-to-image\": {\n \"models\": [\n \"nano-banana\",\n \"nano-banana-2\",\n \"nano-banana-2-lite\",\n \"nano-banana-pro\"\n ],\n \"fields_by_model\": {\n \"nano-banana\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n }\n },\n \"nano-banana-2\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n },\n \"nano-banana-2-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 1,\n \"max\": 20000,\n \"length\": true\n }\n },\n \"nano-banana-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"nano-banana-2-lite\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type { CompletedEditImageResponse, EditImageParams, EditImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/edit_image';\nconst DEFAULT_MODEL = 'nano-banana-2-lite';\n\n/** Modifies existing images based on text prompts. Requires source images to edit. */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Edit an image using text prompts and source images and wait until complete.\n * @param params Edit parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit with image results.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an image edit task; returns immediately with a task id.\n * @param params Edit parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = { model: DEFAULT_MODEL, ...compactParams(params) };\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image edit task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image edit task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse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E/B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AD9BA,IAAAE,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","DEFAULT_MODEL","import_core"]}
|
package/dist/index.mjs
CHANGED
|
@@ -9,9 +9,41 @@ import { pollUntilComplete } from "@runapi.ai/core/internal";
|
|
|
9
9
|
var contract = {
|
|
10
10
|
"edit-image": {
|
|
11
11
|
"models": [
|
|
12
|
+
"nano-banana-2-lite",
|
|
12
13
|
"nano-banana-edit"
|
|
13
14
|
],
|
|
14
15
|
"fields_by_model": {
|
|
16
|
+
"nano-banana-2-lite": {
|
|
17
|
+
"aspect_ratio": {
|
|
18
|
+
"enum": [
|
|
19
|
+
"1:1",
|
|
20
|
+
"1:4",
|
|
21
|
+
"1:8",
|
|
22
|
+
"2:3",
|
|
23
|
+
"3:2",
|
|
24
|
+
"3:4",
|
|
25
|
+
"4:1",
|
|
26
|
+
"4:3",
|
|
27
|
+
"4:5",
|
|
28
|
+
"5:4",
|
|
29
|
+
"8:1",
|
|
30
|
+
"9:16",
|
|
31
|
+
"16:9",
|
|
32
|
+
"21:9",
|
|
33
|
+
"auto"
|
|
34
|
+
],
|
|
35
|
+
"required": true
|
|
36
|
+
},
|
|
37
|
+
"prompt": {
|
|
38
|
+
"required": true,
|
|
39
|
+
"min": 1,
|
|
40
|
+
"max": 2e4,
|
|
41
|
+
"length": true
|
|
42
|
+
},
|
|
43
|
+
"source_image_urls": {
|
|
44
|
+
"required": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
15
47
|
"nano-banana-edit": {
|
|
16
48
|
"aspect_ratio": {
|
|
17
49
|
"enum": [
|
|
@@ -38,7 +70,17 @@ var contract = {
|
|
|
38
70
|
"required": true
|
|
39
71
|
}
|
|
40
72
|
}
|
|
41
|
-
}
|
|
73
|
+
},
|
|
74
|
+
"rules": [
|
|
75
|
+
{
|
|
76
|
+
"when": {
|
|
77
|
+
"model": "nano-banana-2-lite"
|
|
78
|
+
},
|
|
79
|
+
"forbidden": [
|
|
80
|
+
"output_format"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
42
84
|
},
|
|
43
85
|
"text-to-image": {
|
|
44
86
|
"models": [
|
|
@@ -183,6 +225,7 @@ var contract = {
|
|
|
183
225
|
|
|
184
226
|
// src/resources/text-to-image.ts
|
|
185
227
|
var ENDPOINT = "/api/v1/nano_banana/text_to_image";
|
|
228
|
+
var DEFAULT_MODEL = "nano-banana-2-lite";
|
|
186
229
|
var TextToImage = class {
|
|
187
230
|
constructor(http) {
|
|
188
231
|
this.http = http;
|
|
@@ -209,7 +252,7 @@ var TextToImage = class {
|
|
|
209
252
|
* @returns The task creation result with id.
|
|
210
253
|
*/
|
|
211
254
|
async create(params, options) {
|
|
212
|
-
const body = compactParams(params);
|
|
255
|
+
const body = { model: DEFAULT_MODEL, ...compactParams(params) };
|
|
213
256
|
validateParams(contract["text-to-image"], body);
|
|
214
257
|
return this.http.request("POST", ENDPOINT, {
|
|
215
258
|
body,
|
|
@@ -233,13 +276,14 @@ var TextToImage = class {
|
|
|
233
276
|
import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
|
|
234
277
|
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
235
278
|
var ENDPOINT2 = "/api/v1/nano_banana/edit_image";
|
|
279
|
+
var DEFAULT_MODEL2 = "nano-banana-2-lite";
|
|
236
280
|
var EditImage = class {
|
|
237
281
|
constructor(http) {
|
|
238
282
|
this.http = http;
|
|
239
283
|
}
|
|
240
284
|
http;
|
|
241
285
|
/**
|
|
242
|
-
* Edit an image using text prompts and
|
|
286
|
+
* Edit an image using text prompts and source images and wait until complete.
|
|
243
287
|
* @param params Edit parameters.
|
|
244
288
|
* @param options Per-request and polling overrides.
|
|
245
289
|
* @returns The completed edit with image results.
|
|
@@ -259,7 +303,7 @@ var EditImage = class {
|
|
|
259
303
|
* @returns The task creation result with id.
|
|
260
304
|
*/
|
|
261
305
|
async create(params, options) {
|
|
262
|
-
const body = compactParams2(params);
|
|
306
|
+
const body = { model: DEFAULT_MODEL2, ...compactParams2(params) };
|
|
263
307
|
validateParams2(contract["edit-image"], body);
|
|
264
308
|
return this.http.request("POST", ENDPOINT2, {
|
|
265
309
|
body,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * NanoBanana image generation and editing API client.\n *\n * Three generation tiers: standard (fast), pro (higher resolution, more\n * reference images), and v2 (longest prompts, extreme aspect ratios, up to 14\n * reference images). Editing uses the dedicated `nano-banana-edit` model.\n *\n * @example\n * ```typescript\n * const client = new NanoBananaClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'nano-banana-pro',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class NanoBananaClient extends BaseClient {\n /** Generate images from text prompts with optional reference image guidance. */\n public readonly textToImage: TextToImage;\n /** Edit existing images using text prompts and source images. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/text_to_image';\n\n/** Generates images from text prompts with optional reference image guidance. Model tier controls prompt length, resolution, and reference image limits. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image from a text prompt and wait until complete.\n * @param params Generation parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed generation with image results.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create an image generation task; returns immediately with a task id.\n * @param params Generation 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 const body = compactParams(params);\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image generation task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image generation 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","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"nano-banana-edit\"\n ],\n \"fields_by_model\": {\n \"nano-banana-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"source_image_urls\": {\n \"required\": true\n }\n }\n }\n },\n \"text-to-image\": {\n \"models\": [\n \"nano-banana\",\n \"nano-banana-2\",\n \"nano-banana-2-lite\",\n \"nano-banana-pro\"\n ],\n \"fields_by_model\": {\n \"nano-banana\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n }\n },\n \"nano-banana-2\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n },\n \"nano-banana-2-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 1,\n \"max\": 20000,\n \"length\": true\n }\n },\n \"nano-banana-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"nano-banana-2-lite\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type { CompletedEditImageResponse, EditImageParams, EditImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/edit_image';\n\n/** Modifies existing images based on text prompts. Requires source images to edit. */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Edit an image using text prompts and reference images and wait until complete.\n * @param params Edit parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit with image results.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an image edit task; returns immediately with a task id.\n * @param params Edit parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image edit task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image edit task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { NanoBananaClient } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\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,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,oBAAoB;AAAA,QAClB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,eAAe;AAAA,QACb,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,iBAAiB;AAAA,QACf,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA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M,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAAyB,SAAuD;AAC3F,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,YAAY,GAAmB,IAA+B;AACtF,WAAO,KAAK,KAAK,QAA4B,QAAQH,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAsD;AAC1E,WAAO,KAAK,KAAK,QAA2B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACtE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AH7BO,IAAM,mBAAN,cAA+B,WAAW;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AI/BA;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","validateParams","pollUntilComplete","ENDPOINT","pollUntilComplete","compactParams","validateParams"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/resources/text-to-image.ts","../src/contract_gen.ts","../src/resources/edit-image.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToImage } from './resources/text-to-image';\nimport { EditImage } from './resources/edit-image';\n\n/**\n * NanoBanana image generation and editing API client.\n *\n * Generation tiers include standard, pro, v2, and v2 lite. Image editing\n * supports `nano-banana-2-lite` and the dedicated `nano-banana-edit` model.\n *\n * @example\n * ```typescript\n * const client = new NanoBananaClient({\n * apiKey: 'your-api-key',\n * baseUrl: 'https://runapi.ai',\n * });\n *\n * const result = await client.textToImage.run({\n * model: 'nano-banana-pro',\n * prompt: 'A futuristic cityscape at night',\n * });\n * ```\n */\nexport class NanoBananaClient extends BaseClient {\n /** Generate images from text prompts with optional reference image guidance. */\n public readonly textToImage: TextToImage;\n /** Edit existing images using text prompts and source images. */\n public readonly editImage: EditImage;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToImage = new TextToImage(this.http);\n this.editImage = new EditImage(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToImageResponse,\n TextToImageParams,\n TextToImageResponse,\n TaskCreateResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/text_to_image';\nconst DEFAULT_MODEL = 'nano-banana-2-lite';\n\n/** Generates images from text prompts with optional reference image guidance. Model tier controls prompt length, resolution, and reference image limits. */\nexport class TextToImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate an image from a text prompt and wait until complete.\n * @param params Generation parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed generation with image results.\n */\n async run(params: TextToImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToImageResponse;\n }\n\n /**\n * Create an image generation task; returns immediately with a task id.\n * @param params Generation 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 const body = { model: DEFAULT_MODEL, ...compactParams(params) };\n validateParams(contract['text-to-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image generation task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image generation 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","export const contract = {\n \"edit-image\": {\n \"models\": [\n \"nano-banana-2-lite\",\n \"nano-banana-edit\"\n ],\n \"fields_by_model\": {\n \"nano-banana-2-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 1,\n \"max\": 20000,\n \"length\": true\n },\n \"source_image_urls\": {\n \"required\": true\n }\n },\n \"nano-banana-edit\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\"\n ]\n },\n \"source_image_urls\": {\n \"required\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"nano-banana-2-lite\"\n },\n \"forbidden\": [\n \"output_format\"\n ]\n }\n ]\n },\n \"text-to-image\": {\n \"models\": [\n \"nano-banana\",\n \"nano-banana-2\",\n \"nano-banana-2-lite\",\n \"nano-banana-pro\"\n ],\n \"fields_by_model\": {\n \"nano-banana\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"9:16\",\n \"16:9\",\n \"3:4\",\n \"4:3\",\n \"3:2\",\n \"2:3\",\n \"5:4\",\n \"4:5\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n }\n },\n \"nano-banana-2\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n },\n \"nano-banana-2-lite\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"1:4\",\n \"1:8\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:1\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"8:1\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ],\n \"required\": true\n },\n \"prompt\": {\n \"required\": true,\n \"min\": 1,\n \"max\": 20000,\n \"length\": true\n }\n },\n \"nano-banana-pro\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"1:1\",\n \"2:3\",\n \"3:2\",\n \"3:4\",\n \"4:3\",\n \"4:5\",\n \"5:4\",\n \"9:16\",\n \"16:9\",\n \"21:9\",\n \"auto\"\n ]\n },\n \"output_format\": {\n \"enum\": [\n \"png\",\n \"jpeg\",\n \"jpg\"\n ]\n },\n \"output_resolution\": {\n \"enum\": [\n \"1k\",\n \"2k\",\n \"4k\"\n ]\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"nano-banana-2-lite\"\n },\n \"forbidden\": [\n \"output_resolution\",\n \"output_format\"\n ]\n }\n ]\n }\n} as const;\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type { CompletedEditImageResponse, EditImageParams, EditImageResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/nano_banana/edit_image';\nconst DEFAULT_MODEL = 'nano-banana-2-lite';\n\n/** Modifies existing images based on text prompts. Requires source images to edit. */\nexport class EditImage {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Edit an image using text prompts and source images and wait until complete.\n * @param params Edit parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed edit with image results.\n */\n async run(params: EditImageParams, options?: RequestOptions & PollingOptions): Promise<CompletedEditImageResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<EditImageResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedEditImageResponse;\n }\n\n /**\n * Create an image edit task; returns immediately with a task id.\n * @param params Edit parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: EditImageParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = { model: DEFAULT_MODEL, ...compactParams(params) };\n validateParams(contract['edit-image'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of an image edit task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current image edit task status.\n */\n async get(id: string, options?: RequestOptions): Promise<EditImageResponse> {\n return this.http.request<EditImageResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { NanoBananaClient } from './client';\nexport * from './types';\n\n// Re-export core errors for convenience\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,eAAe,sBAAsB;AAC9C,SAAS,yBAAyB;;;ACF3B,IAAM,WAAW;AAAA,EACtB,cAAc;AAAA,IACZ,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,sBAAsB;AAAA,QACpB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,YAAY;AAAA,QACd;AAAA,QACA,UAAU;AAAA,UACR,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,OAAO;AAAA,UACP,UAAU;AAAA,QACZ;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,MACA,oBAAoB;AAAA,QAClB,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,UACnB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP;AAAA,QACE,QAAQ;AAAA,UACN,SAAS;AAAA,QACX;AAAA,QACA,aAAa;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAA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,EAE/B;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,YAAY,IAAI,UAAU,KAAK,IAAI;AAAA,EAC1C;AACF;;;AI9BA;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","validateParams","pollUntilComplete","ENDPOINT","DEFAULT_MODEL","pollUntilComplete","compactParams","validateParams"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"runapi": {
|
|
4
4
|
"slug": "nano-banana"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.10",
|
|
7
7
|
"description": "RunAPI Nano Banana SDK for text-to-image and image editing workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"module": "./dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"clean": "rm -rf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@runapi.ai/core": "^0.2.
|
|
34
|
+
"@runapi.ai/core": "^0.2.11"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.0.0",
|