runapi-nano-banana 0.2.5 → 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 +4 -4
- data/README.md +2 -0
- data/lib/runapi/nano_banana/client.rb +12 -10
- data/lib/runapi/nano_banana/types.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6f82c6314ecf49b04a4288ac55dbde5361e2eeeb5b8fcdf897189bd9804902c
|
|
4
|
+
data.tar.gz: 25d20779667b0de9393725fee52f24ad38acc10ac623b634dcb343465b60688a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f1dbb06ac32a0e5673b25b8aedaeb3e9ab287e939cf645452905eb0bd89d1eac9600b23bf9cfa5ca140c509fa3ad31bf7009459967d603d3b0a3b6bff6a4ab5
|
|
7
|
+
data.tar.gz: d1757bc0ef46c180d40a68e63cf40bade362839ec58aac9c96e7dc9abd05764b46e939dd21875191dbe12cf1b529df63860a15fde15529c075bcd6f2a4d57c5f
|
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ status = client.generations.get(task.id)
|
|
|
24
24
|
|
|
25
25
|
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
26
26
|
|
|
27
|
+
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
28
|
+
|
|
27
29
|
## Language notes
|
|
28
30
|
|
|
29
31
|
Use 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.
|
|
@@ -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: "
|
|
14
|
+
# model: "nano-banana-pro", prompt: "A futuristic cityscape"
|
|
11
15
|
# )
|
|
12
|
-
class Client
|
|
13
|
-
# @return [Resources::TextToImage]
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
|
@@ -3,14 +3,19 @@
|
|
|
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
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
|
|
14
|
+
# Output resolution tiers. Pro and v2 default to 1k; higher tiers increase generation time.
|
|
11
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
20
|
optional :url, String
|
|
16
21
|
optional :origin_url, String
|
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
|
+
version: 0.2.6
|
|
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.
|
|
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.
|
|
25
|
+
version: 0.2.6
|
|
26
26
|
description: The nano banana api Ruby SDK is the language-specific package for Nano
|
|
27
27
|
Banana on RunAPI. Use this nano banana api package for text-to-image, image editing,
|
|
28
28
|
and creative production flows when your application needs JSON request bodies, task
|