@runapi.ai/nano-banana 0.2.4 → 0.2.5
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 +1 -1
- package/dist/index.d.mts +20 -24
- package/dist/index.d.ts +20 -24
- package/package.json +3 -10
- package/skills/nano-banana/README.md +2 -2
- package/skills/nano-banana/SKILL.md +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Nano Banana API JavaScript SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The nano banana api JavaScript SDK is the language-specific package for Nano Banana on RunAPI. Use this nano banana api package for text-to-image, image
|
|
3
|
+
The nano banana api JavaScript SDK is the language-specific package for Nano Banana on RunAPI. Use this nano banana 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 nano banana api README is the JavaScript package guide inside the public `nano-banana-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/nano-banana; for API reference, use https://runapi.ai/docs#nano-banana; for SDK docs, use https://runapi.ai/docs#sdk-nano-banana.
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -3,30 +3,22 @@ export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundEr
|
|
|
3
3
|
|
|
4
4
|
type TextToImageModel = 'nano-banana' | 'nano-banana-pro' | 'nano-banana-2';
|
|
5
5
|
type EditImageModel = 'nano-banana-edit';
|
|
6
|
-
|
|
7
|
-
* Base model aspect ratio options.
|
|
8
|
-
* Note: Base model uses 'image_size' parameter which includes 'auto' option.
|
|
9
|
-
*/
|
|
10
|
-
type ImageSize = '1:1' | '9:16' | '16:9' | '3:4' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '21:9' | 'auto';
|
|
11
|
-
/**
|
|
12
|
-
* Pro model aspect ratio options.
|
|
13
|
-
* Note: Pro model uses 'aspect_ratio' parameter (includes 'auto' option).
|
|
14
|
-
*/
|
|
6
|
+
type BaseAspectRatio = '1:1' | '9:16' | '16:9' | '3:4' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '21:9' | 'auto';
|
|
15
7
|
type AspectRatio = '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9' | 'auto';
|
|
16
8
|
/**
|
|
17
9
|
* V2 model aspect ratio options. Superset of Pro, adding extreme ratios
|
|
18
10
|
* (1:4, 1:8, 4:1, 8:1). Default is 'auto'.
|
|
19
11
|
*/
|
|
20
12
|
type AspectRatioV2 = AspectRatio | '1:4' | '1:8' | '4:1' | '8:1';
|
|
21
|
-
type
|
|
13
|
+
type OutputResolution = '1k' | '2k' | '4k';
|
|
22
14
|
type OutputFormat = 'png' | 'jpg' | 'jpeg';
|
|
23
15
|
interface GenerationBaseParams {
|
|
24
16
|
model: 'nano-banana';
|
|
25
17
|
prompt: string;
|
|
26
18
|
callback_url?: string;
|
|
27
19
|
output_format?: OutputFormat;
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
aspect_ratio?: BaseAspectRatio;
|
|
21
|
+
reference_image_urls?: string[];
|
|
30
22
|
}
|
|
31
23
|
interface GenerationProParams {
|
|
32
24
|
model: 'nano-banana-pro';
|
|
@@ -34,8 +26,8 @@ interface GenerationProParams {
|
|
|
34
26
|
callback_url?: string;
|
|
35
27
|
output_format?: OutputFormat;
|
|
36
28
|
aspect_ratio?: AspectRatio;
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
output_resolution?: OutputResolution;
|
|
30
|
+
reference_image_urls?: string[];
|
|
39
31
|
}
|
|
40
32
|
interface GenerationV2Params {
|
|
41
33
|
model: 'nano-banana-2';
|
|
@@ -43,47 +35,51 @@ interface GenerationV2Params {
|
|
|
43
35
|
callback_url?: string;
|
|
44
36
|
output_format?: OutputFormat;
|
|
45
37
|
aspect_ratio?: AspectRatioV2;
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
output_resolution?: OutputResolution;
|
|
39
|
+
reference_image_urls?: string[];
|
|
48
40
|
}
|
|
49
41
|
type TextToImageParams = GenerationBaseParams | GenerationProParams | GenerationV2Params;
|
|
50
42
|
interface EditImageParams {
|
|
51
43
|
model: 'nano-banana-edit';
|
|
52
44
|
prompt: string;
|
|
53
|
-
|
|
45
|
+
source_image_urls: string[];
|
|
54
46
|
callback_url?: string;
|
|
55
47
|
output_format?: OutputFormat;
|
|
56
|
-
|
|
48
|
+
aspect_ratio?: BaseAspectRatio;
|
|
57
49
|
}
|
|
58
50
|
interface TaskCreateResponse {
|
|
59
51
|
id: string;
|
|
60
52
|
}
|
|
53
|
+
interface Image {
|
|
54
|
+
url: string;
|
|
55
|
+
origin_url?: string;
|
|
56
|
+
}
|
|
61
57
|
interface TextToImageResponse {
|
|
62
58
|
id: string;
|
|
63
59
|
status: AsyncTaskStatus;
|
|
64
|
-
|
|
60
|
+
images?: Image[];
|
|
65
61
|
error?: string;
|
|
66
62
|
[key: string]: unknown;
|
|
67
63
|
}
|
|
68
64
|
interface EditImageResponse {
|
|
69
65
|
id: string;
|
|
70
66
|
status: AsyncTaskStatus;
|
|
71
|
-
|
|
67
|
+
images?: Image[];
|
|
72
68
|
error?: string;
|
|
73
69
|
[key: string]: unknown;
|
|
74
70
|
}
|
|
75
71
|
/**
|
|
76
72
|
* Resolved responses returned by the `run()` methods after polling sees
|
|
77
|
-
* `status: 'completed'`. Narrows the base response so `
|
|
73
|
+
* `status: 'completed'`. Narrows the base response so `images` is
|
|
78
74
|
* guaranteed non-optional in user code.
|
|
79
75
|
*/
|
|
80
76
|
type CompletedTextToImageResponse = TextToImageResponse & {
|
|
81
77
|
status: 'completed';
|
|
82
|
-
|
|
78
|
+
images: Image[];
|
|
83
79
|
};
|
|
84
80
|
type CompletedEditImageResponse = EditImageResponse & {
|
|
85
81
|
status: 'completed';
|
|
86
|
-
|
|
82
|
+
images: Image[];
|
|
87
83
|
};
|
|
88
84
|
|
|
89
85
|
declare class TextToImage {
|
|
@@ -126,4 +122,4 @@ declare class NanoBananaClient {
|
|
|
126
122
|
constructor(options?: ClientOptions);
|
|
127
123
|
}
|
|
128
124
|
|
|
129
|
-
export { type AspectRatio, type AspectRatioV2, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type GenerationBaseParams, type GenerationProParams, type GenerationV2Params, type
|
|
125
|
+
export { type AspectRatio, type AspectRatioV2, type BaseAspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type GenerationBaseParams, type GenerationProParams, type GenerationV2Params, type Image, NanoBananaClient, type OutputFormat, type OutputResolution, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,30 +3,22 @@ export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundEr
|
|
|
3
3
|
|
|
4
4
|
type TextToImageModel = 'nano-banana' | 'nano-banana-pro' | 'nano-banana-2';
|
|
5
5
|
type EditImageModel = 'nano-banana-edit';
|
|
6
|
-
|
|
7
|
-
* Base model aspect ratio options.
|
|
8
|
-
* Note: Base model uses 'image_size' parameter which includes 'auto' option.
|
|
9
|
-
*/
|
|
10
|
-
type ImageSize = '1:1' | '9:16' | '16:9' | '3:4' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '21:9' | 'auto';
|
|
11
|
-
/**
|
|
12
|
-
* Pro model aspect ratio options.
|
|
13
|
-
* Note: Pro model uses 'aspect_ratio' parameter (includes 'auto' option).
|
|
14
|
-
*/
|
|
6
|
+
type BaseAspectRatio = '1:1' | '9:16' | '16:9' | '3:4' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '21:9' | 'auto';
|
|
15
7
|
type AspectRatio = '1:1' | '2:3' | '3:2' | '3:4' | '4:3' | '4:5' | '5:4' | '9:16' | '16:9' | '21:9' | 'auto';
|
|
16
8
|
/**
|
|
17
9
|
* V2 model aspect ratio options. Superset of Pro, adding extreme ratios
|
|
18
10
|
* (1:4, 1:8, 4:1, 8:1). Default is 'auto'.
|
|
19
11
|
*/
|
|
20
12
|
type AspectRatioV2 = AspectRatio | '1:4' | '1:8' | '4:1' | '8:1';
|
|
21
|
-
type
|
|
13
|
+
type OutputResolution = '1k' | '2k' | '4k';
|
|
22
14
|
type OutputFormat = 'png' | 'jpg' | 'jpeg';
|
|
23
15
|
interface GenerationBaseParams {
|
|
24
16
|
model: 'nano-banana';
|
|
25
17
|
prompt: string;
|
|
26
18
|
callback_url?: string;
|
|
27
19
|
output_format?: OutputFormat;
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
aspect_ratio?: BaseAspectRatio;
|
|
21
|
+
reference_image_urls?: string[];
|
|
30
22
|
}
|
|
31
23
|
interface GenerationProParams {
|
|
32
24
|
model: 'nano-banana-pro';
|
|
@@ -34,8 +26,8 @@ interface GenerationProParams {
|
|
|
34
26
|
callback_url?: string;
|
|
35
27
|
output_format?: OutputFormat;
|
|
36
28
|
aspect_ratio?: AspectRatio;
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
output_resolution?: OutputResolution;
|
|
30
|
+
reference_image_urls?: string[];
|
|
39
31
|
}
|
|
40
32
|
interface GenerationV2Params {
|
|
41
33
|
model: 'nano-banana-2';
|
|
@@ -43,47 +35,51 @@ interface GenerationV2Params {
|
|
|
43
35
|
callback_url?: string;
|
|
44
36
|
output_format?: OutputFormat;
|
|
45
37
|
aspect_ratio?: AspectRatioV2;
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
output_resolution?: OutputResolution;
|
|
39
|
+
reference_image_urls?: string[];
|
|
48
40
|
}
|
|
49
41
|
type TextToImageParams = GenerationBaseParams | GenerationProParams | GenerationV2Params;
|
|
50
42
|
interface EditImageParams {
|
|
51
43
|
model: 'nano-banana-edit';
|
|
52
44
|
prompt: string;
|
|
53
|
-
|
|
45
|
+
source_image_urls: string[];
|
|
54
46
|
callback_url?: string;
|
|
55
47
|
output_format?: OutputFormat;
|
|
56
|
-
|
|
48
|
+
aspect_ratio?: BaseAspectRatio;
|
|
57
49
|
}
|
|
58
50
|
interface TaskCreateResponse {
|
|
59
51
|
id: string;
|
|
60
52
|
}
|
|
53
|
+
interface Image {
|
|
54
|
+
url: string;
|
|
55
|
+
origin_url?: string;
|
|
56
|
+
}
|
|
61
57
|
interface TextToImageResponse {
|
|
62
58
|
id: string;
|
|
63
59
|
status: AsyncTaskStatus;
|
|
64
|
-
|
|
60
|
+
images?: Image[];
|
|
65
61
|
error?: string;
|
|
66
62
|
[key: string]: unknown;
|
|
67
63
|
}
|
|
68
64
|
interface EditImageResponse {
|
|
69
65
|
id: string;
|
|
70
66
|
status: AsyncTaskStatus;
|
|
71
|
-
|
|
67
|
+
images?: Image[];
|
|
72
68
|
error?: string;
|
|
73
69
|
[key: string]: unknown;
|
|
74
70
|
}
|
|
75
71
|
/**
|
|
76
72
|
* Resolved responses returned by the `run()` methods after polling sees
|
|
77
|
-
* `status: 'completed'`. Narrows the base response so `
|
|
73
|
+
* `status: 'completed'`. Narrows the base response so `images` is
|
|
78
74
|
* guaranteed non-optional in user code.
|
|
79
75
|
*/
|
|
80
76
|
type CompletedTextToImageResponse = TextToImageResponse & {
|
|
81
77
|
status: 'completed';
|
|
82
|
-
|
|
78
|
+
images: Image[];
|
|
83
79
|
};
|
|
84
80
|
type CompletedEditImageResponse = EditImageResponse & {
|
|
85
81
|
status: 'completed';
|
|
86
|
-
|
|
82
|
+
images: Image[];
|
|
87
83
|
};
|
|
88
84
|
|
|
89
85
|
declare class TextToImage {
|
|
@@ -126,4 +122,4 @@ declare class NanoBananaClient {
|
|
|
126
122
|
constructor(options?: ClientOptions);
|
|
127
123
|
}
|
|
128
124
|
|
|
129
|
-
export { type AspectRatio, type AspectRatioV2, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type GenerationBaseParams, type GenerationProParams, type GenerationV2Params, type
|
|
125
|
+
export { type AspectRatio, type AspectRatioV2, type BaseAspectRatio, type CompletedEditImageResponse, type CompletedTextToImageResponse, type EditImageModel, type EditImageParams, type EditImageResponse, type GenerationBaseParams, type GenerationProParams, type GenerationV2Params, type Image, NanoBananaClient, type OutputFormat, type OutputResolution, type TaskCreateResponse, type TextToImageModel, type TextToImageParams, type TextToImageResponse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runapi.ai/nano-banana",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "RunAPI Nano Banana SDK for JavaScript, Ruby, and Go",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -25,17 +25,10 @@
|
|
|
25
25
|
"build": "tsup",
|
|
26
26
|
"test": "vitest run",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
|
-
"clean": "rm -rf dist"
|
|
29
|
-
"test:base": "dotenv -e manual-tests/.env -- tsx manual-tests/test-generation-base.ts",
|
|
30
|
-
"test:pro": "dotenv -e manual-tests/.env -- tsx manual-tests/test-generation-pro.ts",
|
|
31
|
-
"test:edit": "dotenv -e manual-tests/.env -- tsx manual-tests/test-edit.ts",
|
|
32
|
-
"test:polling": "dotenv -e manual-tests/.env -- tsx manual-tests/test-polling.ts",
|
|
33
|
-
"test:errors": "dotenv -e manual-tests/.env -- tsx manual-tests/test-error-handling.ts",
|
|
34
|
-
"test:all": "dotenv -e manual-tests/.env -- tsx manual-tests/test-all.ts",
|
|
35
|
-
"test:manual": "pnpm run test:all"
|
|
28
|
+
"clean": "rm -rf dist"
|
|
36
29
|
},
|
|
37
30
|
"dependencies": {
|
|
38
|
-
"@runapi.ai/core": "^0.2.
|
|
31
|
+
"@runapi.ai/core": "^0.2.5"
|
|
39
32
|
},
|
|
40
33
|
"devDependencies": {
|
|
41
34
|
"@types/node": "^20.0.0",
|
|
@@ -53,9 +53,9 @@ const client = new NanoBananaClient();
|
|
|
53
53
|
const result = await client.textToImage.run({
|
|
54
54
|
model: 'nano-banana',
|
|
55
55
|
prompt: 'A bowl of fruit on a wooden table, soft daylight',
|
|
56
|
-
|
|
56
|
+
aspect_ratio: '16:9',
|
|
57
57
|
});
|
|
58
|
-
const url = result.
|
|
58
|
+
const url = result.images[0].url;
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
## Routing
|
|
@@ -34,7 +34,7 @@ Generate and edit images with Nano Banana through RunAPI. The default path for o
|
|
|
34
34
|
|
|
35
35
|
The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
|
|
36
36
|
|
|
37
|
-
Inspect the available
|
|
37
|
+
Inspect the available commands and request fields with CLI help:
|
|
38
38
|
|
|
39
39
|
```shell
|
|
40
40
|
runapi nano-banana --help
|
|
@@ -54,7 +54,7 @@ runapi nano-banana text-to-image --async --input-file request.json
|
|
|
54
54
|
runapi wait <task-id> --service nano-banana --action text-to-image
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Available
|
|
57
|
+
Available commands: `text-to-image`, `edit-image`.
|
|
58
58
|
|
|
59
59
|
## SDK integration path
|
|
60
60
|
|