runapi-nano-banana 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad7b97a266bf40926a5a50411bf11f7d39dee8be80fe47c7c97ef9ae3ef41684
4
- data.tar.gz: '09678684916edba28b6a02e3df4bbbc4f6f6869b9447acce18c937eee67995c0'
3
+ metadata.gz: d6f82c6314ecf49b04a4288ac55dbde5361e2eeeb5b8fcdf897189bd9804902c
4
+ data.tar.gz: 25d20779667b0de9393725fee52f24ad38acc10ac623b634dcb343465b60688a
5
5
  SHA512:
6
- metadata.gz: 945ae7da15e1c54507af064c254f4a9b417965cbd1bbfea947644e0dc69c516e9a6a34af43a842c941d45aeaabd84b17902d3cba8f9fcb2696351eb310a0c778
7
- data.tar.gz: 102d78f223c3ccd3baef8525e41336418431fec1ade4b5785be0b78feb70ac0acb323b3142a2f2ff141032218f22298564bad872ae7f49a5f7d08c7428e9e03f
6
+ metadata.gz: 8f1dbb06ac32a0e5673b25b8aedaeb3e9ab287e939cf645452905eb0bd89d1eac9600b23bf9cfa5ca140c509fa3ad31bf7009459967d603d3b0a3b6bff6a4ab5
7
+ data.tar.gz: d1757bc0ef46c180d40a68e63cf40bade362839ec58aac9c96e7dc9abd05764b46e939dd21875191dbe12cf1b529df63860a15fde15529c075bcd6f2a4d57c5f
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # Nano Banana API Ruby SDK for RunAPI
2
+
3
+ The nano banana api Ruby 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 Ruby.
4
+
5
+ This nano banana api README is the Ruby 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
+
7
+ ## Install
8
+
9
+ ```bash
10
+ gem install runapi-nano-banana
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ ```ruby
16
+ require "runapi-nano-banana"
17
+
18
+ client = RunApi::NanoBanana::Client.new
19
+ task = client.generations.create(
20
+ # Pass the Nano Banana JSON request body from https://runapi.ai/docs#nano-banana.
21
+ )
22
+ status = client.generations.get(task.id)
23
+ ```
24
+
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
+
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
+
29
+ ## Language notes
30
+
31
+ Use Ruby keyword arguments and the `RunApi::NanoBanana` error classes when building image jobs, Rails workers, or scripts. The available resources include generations, and edits. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
32
+
33
+ ## Links
34
+
35
+ - Model page: https://runapi.ai/models/nano-banana
36
+ - SDK docs: https://runapi.ai/docs#sdk-nano-banana
37
+ - Product docs: https://runapi.ai/docs#nano-banana
38
+ - Pricing and rate limits: https://runapi.ai/models/nano-banana/nano-banana
39
+ - Provider comparison: https://runapi.ai/providers/google
40
+ - Full catalog: https://runapi.ai/models
41
+ - Repository: https://github.com/runapi-ai/nano-banana-sdk
42
+
43
+ ## License
44
+
45
+ Licensed under the Apache License, Version 2.0.
@@ -2,23 +2,25 @@
2
2
 
3
3
  module RunApi
4
4
  module NanoBanana
5
- # NanoBanana image generation API client.
5
+ # NanoBanana image generation and editing API client.
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.
6
10
  #
7
11
  # @example
8
12
  # client = RunApi::NanoBanana::Client.new(api_key: "your-api-key")
9
13
  # result = client.text_to_image.run(
10
- # model: "flux-kontext-pro", prompt: "A futuristic cityscape"
14
+ # model: "nano-banana-pro", prompt: "A futuristic cityscape"
11
15
  # )
12
- class Client
13
- # @return [Resources::TextToImage] Image generation operations.
14
- # @return [Resources::EditImage] Image editing operations.
15
- attr_reader :text_to_image, :edit_image
16
+ class Client < RunApi::Core::Client
17
+ # @return [Resources::TextToImage] Generate images from text prompts with optional reference image guidance.
18
+ attr_reader :text_to_image
19
+ # @return [Resources::EditImage] Edit existing images using text prompts and source images.
20
+ attr_reader :edit_image
16
21
 
17
22
  def initialize(api_key: nil, **options)
18
- @api_key = Core::Auth.resolve_api_key(api_key)
19
-
20
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
21
- http = client_options.http_client || Core::HttpClient.new(client_options)
23
+ super
22
24
  @text_to_image = Resources::TextToImage.new(http)
23
25
  @edit_image = Resources::EditImage.new(http)
24
26
  end
@@ -20,7 +20,7 @@ module RunApi
20
20
  # Edit an image and wait until complete.
21
21
  #
22
22
  # @param params [Hash] edit parameters
23
- # @return [RunApi::NanoBanana::Types::CompletedEditImageResponse] completed edit with result URLs
23
+ # @return [RunApi::NanoBanana::Types::CompletedEditImageResponse] completed edit with image results
24
24
  def run(**params)
25
25
  task = create(**params)
26
26
  poll_until_complete { get(task.id) }
@@ -49,7 +49,7 @@ module RunApi
49
49
  def validate_params!(params)
50
50
  raise Core::ValidationError, "model is required" unless param(params, :model)
51
51
  raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
52
- raise Core::ValidationError, "image_urls is required" unless param(params, :image_urls)
52
+ raise Core::ValidationError, "source_image_urls is required" unless param(params, :source_image_urls)
53
53
 
54
54
  model = param(params, :model)
55
55
  unless Types::EDIT_MODELS.include?(model)
@@ -57,6 +57,7 @@ module RunApi
57
57
  end
58
58
 
59
59
  validate_optional!(params, :output_format, Types::OUTPUT_FORMATS)
60
+ validate_optional!(params, :aspect_ratio, Types::BASE_ASPECT_RATIOS)
60
61
  end
61
62
  end
62
63
  end
@@ -20,7 +20,7 @@ module RunApi
20
20
  # Generate an image and wait until complete.
21
21
  #
22
22
  # @param params [Hash] generation parameters
23
- # @return [RunApi::NanoBanana::Types::CompletedTextToImageResponse] completed generation with result URLs
23
+ # @return [RunApi::NanoBanana::Types::CompletedTextToImageResponse] completed generation with image results
24
24
  def run(**params)
25
25
  task = create(**params)
26
26
  poll_until_complete { get(task.id) }
@@ -56,7 +56,7 @@ module RunApi
56
56
  end
57
57
 
58
58
  validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
59
- validate_optional!(params, :resolution, Types::RESOLUTIONS)
59
+ validate_optional!(params, :output_resolution, Types::OUTPUT_RESOLUTIONS)
60
60
  validate_optional!(params, :output_format, Types::OUTPUT_FORMATS)
61
61
  end
62
62
  end
@@ -3,18 +3,22 @@
3
3
  module RunApi
4
4
  module NanoBanana
5
5
  module Types
6
+ # Generation tiers: standard (fast), pro (higher res + more refs), v2 (longest prompts + extreme ratios).
6
7
  GENERATION_MODELS = %w[nano-banana nano-banana-pro nano-banana-2].freeze
8
+ # Dedicated editing model. Requires source images to transform.
7
9
  EDIT_MODELS = %w[nano-banana-edit].freeze
8
10
 
9
- IMAGE_SIZES = %w[1:1 9:16 16:9 3:4 4:3 3:2 2:3 5:4 4:5 21:9 auto].freeze
11
+ BASE_ASPECT_RATIOS = %w[1:1 9:16 16:9 3:4 4:3 3:2 2:3 5:4 4:5 21:9 auto].freeze
12
+ # Full aspect ratio set including extreme panoramic ratios (1:4, 1:8, 4:1, 8:1) for v2.
10
13
  ASPECT_RATIOS = %w[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].freeze
11
- RESOLUTIONS = %w[1K 2K 4K].freeze
14
+ # Output resolution tiers. Pro and v2 default to 1k; higher tiers increase generation time.
15
+ OUTPUT_RESOLUTIONS = %w[1k 2k 4k].freeze
12
16
  OUTPUT_FORMATS = %w[png jpg jpeg].freeze
13
17
 
18
+ # A single generated or edited image result.
14
19
  class Image < RunApi::Core::BaseModel
15
- optional :id, String
16
20
  optional :url, String
17
- optional :image_url, String
21
+ optional :origin_url, String
18
22
  end
19
23
 
20
24
  class AsyncTaskResponse < RunApi::Core::TaskResponse
@@ -23,24 +27,22 @@ module RunApi
23
27
  end
24
28
 
25
29
  class TextToImageResponse < AsyncTaskResponse
26
- optional :result_urls, [ String ]
27
- optional :image, -> { Image }
30
+ optional :images, [-> { Image }]
28
31
  end
29
32
 
30
33
  class EditImageResponse < AsyncTaskResponse
31
- optional :result_urls, [ String ]
32
- optional :image, -> { Image }
34
+ optional :images, [-> { Image }]
33
35
  end
34
36
 
35
37
  # Narrowed responses returned by `run()` methods once polling observes
36
- # `status: "completed"`. `result_urls` is required so consumers never
38
+ # `status: "completed"`. `images` is required so consumers never
37
39
  # have to null-check it on a successful task.
38
40
  class CompletedTextToImageResponse < TextToImageResponse
39
- required :result_urls, [ String ]
41
+ required :images, [-> { Image }]
40
42
  end
41
43
 
42
44
  class CompletedEditImageResponse < EditImageResponse
43
- required :result_urls, [ String ]
45
+ required :images, [-> { Image }]
44
46
  end
45
47
  end
46
48
  end
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.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,22 +15,27 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.4
18
+ version: 0.2.6
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.4
26
- description: RunAPI Nano Banana SDK for JavaScript, Ruby, and Go
25
+ version: 0.2.6
26
+ description: The nano banana api Ruby SDK is the language-specific package for Nano
27
+ Banana on RunAPI. Use this nano banana api package for text-to-image, image editing,
28
+ and creative production flows when your application needs JSON request bodies, task
29
+ status lookup, and consistent RunAPI errors in Ruby.
27
30
  email:
28
31
  - contact@runapi.ai
29
32
  executables: []
30
33
  extensions: []
31
- extra_rdoc_files: []
34
+ extra_rdoc_files:
35
+ - README.md
32
36
  files:
33
37
  - LICENSE
38
+ - README.md
34
39
  - lib/runapi-nano_banana.rb
35
40
  - lib/runapi/nano_banana.rb
36
41
  - lib/runapi/nano_banana/client.rb
@@ -42,7 +47,7 @@ licenses:
42
47
  - Apache-2.0
43
48
  metadata:
44
49
  homepage_uri: https://runapi.ai/models/nano-banana
45
- documentation_uri: https://github.com/runapi-ai/nano-banana-sdk/blob/main/README.md
50
+ documentation_uri: https://github.com/runapi-ai/nano-banana-sdk/blob/main/ruby/README.md
46
51
  source_code_uri: https://github.com/runapi-ai/nano-banana-sdk
47
52
  changelog_uri: https://github.com/runapi-ai/nano-banana-sdk/blob/main/CHANGELOG.md
48
53
  rdoc_options: []
@@ -61,5 +66,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
66
  requirements: []
62
67
  rubygems_version: 4.0.10
63
68
  specification_version: 4
64
- summary: Nano Banana API SDKs for JavaScript, Ruby, and Go on RunAPI.
69
+ summary: Nano Banana API Ruby SDK for RunAPI
65
70
  test_files: []