runapi-nano-banana 0.2.7 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 832dd3e77b5049f32c247319b78e0a05b8c5c7d71c4cc0e16a1626011ba9248b
4
- data.tar.gz: 23d94cd56e9f85984d903d7c8b4c9e1582e58614a48eae82d1f6bdbdcf5c0e1a
3
+ metadata.gz: ff7379866c15e897669c566806533c0dac1222b5d776a9e7399310a4ab8b4642
4
+ data.tar.gz: acd9c5be4da48065a1c19ded49cf99e3fb46be88bd734187428c2b7317cc585f
5
5
  SHA512:
6
- metadata.gz: ba6d8452a6ddc1fcc6d700e20943f7cc454f9ebf653e50bdfef36365fd0bb8543e6b961b6400ed3943c6f1c1fc86eec9d9a5116c213ee8cf9338e1726e4f5d50
7
- data.tar.gz: 127d62230b0d4c6a9c5f00fa3a38f49447426dba48299babc64c4ba6d697e5bcaa53b0be2c9fce803a1322eeac44d2cc12d61e0cfa2c9bd318125952fd0409cf
6
+ metadata.gz: 766be94a6fd4a677e4fc81d09a09475f70605f3f0cbe73bc12e855dcee6301b36e4f0fac315f813f431beed0ee3fcc18db804e06585966bf2d24d96cbe410a85
7
+ data.tar.gz: 82977ca43c84d766356050a8d23d81060479b6857cebe60442500079e080a976a2df3a7679b20368463b8ba6b4bd375723e08918cb809f69c3a1bf0115d18a03
data/README.md CHANGED
@@ -13,7 +13,7 @@ gem install runapi-nano-banana
13
13
  ## Quick start
14
14
 
15
15
  ```ruby
16
- require "runapi-nano-banana"
16
+ require "runapi/nano_banana"
17
17
 
18
18
  client = RunApi::NanoBanana::Client.new
19
19
  task = client.text_to_image.create(
@@ -4,9 +4,8 @@ module RunApi
4
4
  module NanoBanana
5
5
  # NanoBanana image generation and editing API client.
6
6
  #
7
- # Three generation tiers: standard (fast), pro (higher resolution, more
8
- # reference images), and v2 (longest prompts, extreme aspect ratios, up to
9
- # 14 reference images). Editing uses the dedicated +nano-banana-edit+ model.
7
+ # Generation tiers include standard, pro, v2, and v2 lite. Image editing
8
+ # supports +nano-banana-2-lite+ and the dedicated +nano-banana-edit+ model.
10
9
  #
11
10
  # @example
12
11
  # client = RunApi::NanoBanana::Client.new(api_key: "your-api-key")
@@ -4,8 +4,23 @@ module RunApi
4
4
  module NanoBanana
5
5
  CONTRACT = {
6
6
  "edit-image" => {
7
- "models" => ["nano-banana-edit"],
7
+ "models" => ["nano-banana-2-lite", "nano-banana-edit"],
8
8
  "fields_by_model" => {
9
+ "nano-banana-2-lite" => {
10
+ "aspect_ratio" => {
11
+ "enum" => ["1:1", "1:4", "1:8", "2:3", "3:2", "3:4", "4:1", "4:3", "4:5", "5:4", "8:1", "9:16", "16:9", "21:9", "auto"],
12
+ "required" => true
13
+ },
14
+ "prompt" => {
15
+ "required" => true,
16
+ "min" => 1,
17
+ "max" => 20000,
18
+ "length" => true
19
+ },
20
+ "source_image_urls" => {
21
+ "required" => true
22
+ }
23
+ },
9
24
  "nano-banana-edit" => {
10
25
  "aspect_ratio" => {
11
26
  "enum" => ["1:1", "9:16", "16:9", "3:4", "4:3", "3:2", "2:3", "5:4", "4:5", "21:9", "auto"]
@@ -17,10 +32,16 @@ module RunApi
17
32
  "required" => true
18
33
  }
19
34
  }
20
- }
35
+ },
36
+ "rules" => [{
37
+ "when" => {
38
+ "model" => "nano-banana-2-lite"
39
+ },
40
+ "forbidden" => ["output_format"]
41
+ }]
21
42
  },
22
43
  "text-to-image" => {
23
- "models" => ["nano-banana", "nano-banana-2", "nano-banana-pro"],
44
+ "models" => ["nano-banana", "nano-banana-2", "nano-banana-2-lite", "nano-banana-pro"],
24
45
  "fields_by_model" => {
25
46
  "nano-banana" => {
26
47
  "aspect_ratio" => {
@@ -41,6 +62,18 @@ module RunApi
41
62
  "enum" => ["1k", "2k", "4k"]
42
63
  }
43
64
  },
65
+ "nano-banana-2-lite" => {
66
+ "aspect_ratio" => {
67
+ "enum" => ["1:1", "1:4", "1:8", "2:3", "3:2", "3:4", "4:1", "4:3", "4:5", "5:4", "8:1", "9:16", "16:9", "21:9", "auto"],
68
+ "required" => true
69
+ },
70
+ "prompt" => {
71
+ "required" => true,
72
+ "min" => 1,
73
+ "max" => 20000,
74
+ "length" => true
75
+ }
76
+ },
44
77
  "nano-banana-pro" => {
45
78
  "aspect_ratio" => {
46
79
  "enum" => ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "auto"]
@@ -52,7 +85,13 @@ module RunApi
52
85
  "enum" => ["1k", "2k", "4k"]
53
86
  }
54
87
  }
55
- }
88
+ },
89
+ "rules" => [{
90
+ "when" => {
91
+ "model" => "nano-banana-2-lite"
92
+ },
93
+ "forbidden" => ["output_resolution", "output_format"]
94
+ }]
56
95
  }
57
96
  }.freeze
58
97
  end
@@ -4,11 +4,12 @@ module RunApi
4
4
  module NanoBanana
5
5
  module Resources
6
6
  # NanoBanana image editing resource.
7
- # Edit existing images using text prompts and reference images.
7
+ # Edit existing images using text prompts and source images.
8
8
  class EditImage
9
9
  include RunApi::Core::ResourceHelpers
10
10
 
11
11
  ENDPOINT = "/api/v1/nano_banana/edit_image"
12
+ DEFAULT_MODEL = "nano-banana-2-lite"
12
13
 
13
14
  RESPONSE_CLASS = Types::EditImageResponse
14
15
  COMPLETED_RESPONSE_CLASS = Types::CompletedEditImageResponse
@@ -21,27 +22,28 @@ module RunApi
21
22
  #
22
23
  # @param params [Hash] edit parameters
23
24
  # @return [RunApi::NanoBanana::Types::CompletedEditImageResponse] completed edit with image results
24
- def run(**params)
25
- task = create(**params)
26
- poll_until_complete { get(task.id) }
25
+ def run(options: nil, **params)
26
+ task = create(options: options, **params)
27
+ poll_until_complete { get(task.id, options: options) }
27
28
  end
28
29
 
29
30
  # Create an image edit task.
30
31
  #
31
32
  # @param params [Hash] edit parameters
32
33
  # @return [RunApi::NanoBanana::Types::EditImageResponse] task creation result with id
33
- def create(**params)
34
+ def create(options: nil, **params)
34
35
  params = compact_params(params)
36
+ params[:model] = DEFAULT_MODEL unless param(params, :model)
35
37
  validate_params!(params)
36
- request(:post, ENDPOINT, body: params)
38
+ request(:post, ENDPOINT, body: params, options: options)
37
39
  end
38
40
 
39
41
  # Get edit status by task ID.
40
42
  #
41
43
  # @param id [String] task ID
42
44
  # @return [RunApi::NanoBanana::Types::EditImageResponse] current edit status
43
- def get(id)
44
- request(:get, "#{ENDPOINT}/#{id}")
45
+ def get(id, options: nil)
46
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
45
47
  end
46
48
 
47
49
  private
@@ -9,6 +9,7 @@ module RunApi
9
9
  include RunApi::Core::ResourceHelpers
10
10
 
11
11
  ENDPOINT = "/api/v1/nano_banana/text_to_image"
12
+ DEFAULT_MODEL = "nano-banana-2-lite"
12
13
 
13
14
  RESPONSE_CLASS = Types::TextToImageResponse
14
15
  COMPLETED_RESPONSE_CLASS = Types::CompletedTextToImageResponse
@@ -19,29 +20,37 @@ module RunApi
19
20
 
20
21
  # Generate an image and wait until complete.
21
22
  #
22
- # @param params [Hash] generation parameters
23
+ # @param params [Hash] generation parameters (see {#create} for accepted keys)
23
24
  # @return [RunApi::NanoBanana::Types::CompletedTextToImageResponse] completed generation with image results
24
- def run(**params)
25
- task = create(**params)
26
- poll_until_complete { get(task.id) }
25
+ def run(options: nil, **params)
26
+ task = create(options: options, **params)
27
+ poll_until_complete { get(task.id, options: options) }
27
28
  end
28
29
 
29
30
  # Create an image generation task.
30
31
  #
31
32
  # @param params [Hash] generation parameters
33
+ # @option params [String] :model optional; defaults to "nano-banana-2-lite"
34
+ # @option params [String] :prompt required; image description
35
+ # @option params [String] :aspect_ratio optional; required for nano-banana-2-lite
36
+ # @option params [String] :output_format optional; "png", "jpeg", or "jpg" (not supported by nano-banana-2-lite)
37
+ # @option params [String] :output_resolution optional; "1k", "2k", or "4k" (nano-banana-pro / nano-banana-2)
38
+ # @option params [Array<String>] :reference_image_urls optional; reference image URLs for visual
39
+ # guidance (nano-banana / nano-banana-pro up to 8, nano-banana-2 up to 14, nano-banana-2-lite up to 10; <=30MB each)
32
40
  # @return [RunApi::NanoBanana::Types::TextToImageResponse] task creation result with id
33
- def create(**params)
41
+ def create(options: nil, **params)
34
42
  params = compact_params(params)
43
+ params[:model] = DEFAULT_MODEL unless param(params, :model)
35
44
  validate_params!(params)
36
- request(:post, ENDPOINT, body: params)
45
+ request(:post, ENDPOINT, body: params, options: options)
37
46
  end
38
47
 
39
48
  # Get generation status by task ID.
40
49
  #
41
50
  # @param id [String] task ID
42
51
  # @return [RunApi::NanoBanana::Types::TextToImageResponse] current generation status
43
- def get(id)
44
- request(:get, "#{ENDPOINT}/#{id}")
52
+ def get(id, options: nil)
53
+ request(:get, "#{ENDPOINT}/#{id}", options: options)
45
54
  end
46
55
 
47
56
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-nano-banana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.7
18
+ version: 0.2.11
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.7
25
+ version: 0.2.11
26
26
  description: The Nano Banana Ruby SDK is the language-specific package for Nano Banana
27
27
  on RunAPI. Use this package for image generation, image editing, and creative production
28
28
  workflows when your application needs request bodies, task status lookup, and consistent