runapi-gpt-image 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/gpt_image/client.rb +5 -6
- data/lib/runapi/gpt_image/types.rb +7 -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: cd933bb97d1ca6a8ccf0708928f4985b1cfb06aae5cef4ec9d65b8b84448d0b1
|
|
4
|
+
data.tar.gz: cd13517224d400ec1f493166b6fc9ce4b6c479c967e14b680efa4f0c4f1db2f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2706384365717c217ffd71e4e654e92c1e24bb57318cd07cf7a420f78f1cb33a74faf19c0e01d6b30075e4d180204afc21cf66a5f6ce6f5a6f975d5eda50d3e6
|
|
7
|
+
data.tar.gz: 2c3b05a82ff0868976e4c0c0277dd1b8baeb9364eb816da8989f7161a6b91a9a36aa9a882e78a8de055a8ed1812e62146098dfb74e5d75285896e41f3fe65b18
|
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::GptImage` 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,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module GptImage
|
|
5
|
-
# GPT Image 1.5
|
|
5
|
+
# GPT Image 1.5 generation and editing API client.
|
|
6
|
+
#
|
|
7
|
+
# Both aspect_ratio and quality are required for all operations.
|
|
6
8
|
#
|
|
7
9
|
# @example
|
|
8
10
|
# client = RunApi::GptImage::Client.new(api_key: "your-api-key")
|
|
@@ -18,17 +20,14 @@ module RunApi
|
|
|
18
20
|
# prompt: "Transform into oil painting",
|
|
19
21
|
# source_image_urls: ["https://cdn.runapi.ai/public/samples/photo.jpg"]
|
|
20
22
|
# )
|
|
21
|
-
class Client
|
|
23
|
+
class Client < RunApi::Core::Client
|
|
22
24
|
# @return [Resources::TextToImage] Text-to-image generation operations.
|
|
23
25
|
attr_reader :text_to_image
|
|
24
26
|
# @return [Resources::EditImage] Image edit operations.
|
|
25
27
|
attr_reader :edit_image
|
|
26
28
|
|
|
27
29
|
def initialize(api_key: nil, **options)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
client_options = Core::ClientOptions.new(api_key: @api_key, **options)
|
|
31
|
-
http = client_options.http_client || Core::HttpClient.new(client_options)
|
|
30
|
+
super
|
|
32
31
|
@text_to_image = Resources::TextToImage.new(http)
|
|
33
32
|
@edit_image = Resources::EditImage.new(http)
|
|
34
33
|
end
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module GptImage
|
|
5
|
+
# Type definitions and constants for GPT Image 1.5.
|
|
6
|
+
# Both aspect_ratio and quality are required for all operations.
|
|
5
7
|
module Types
|
|
6
8
|
MODELS = %w[gpt-image-1.5].freeze
|
|
7
9
|
GENERATION_MODELS = MODELS
|
|
8
10
|
EDIT_MODELS = MODELS
|
|
9
11
|
|
|
12
|
+
# Required for all operations.
|
|
10
13
|
ASPECT_RATIOS = %w[1:1 2:3 3:2].freeze
|
|
14
|
+
# Higher quality takes longer but produces finer detail.
|
|
11
15
|
QUALITY_VALUES = %w[medium high].freeze
|
|
12
16
|
|
|
17
|
+
# A single generated image with its CDN URL.
|
|
13
18
|
class Image < RunApi::Core::BaseModel
|
|
14
19
|
optional :url, String
|
|
15
20
|
end
|
|
16
21
|
|
|
22
|
+
# Generation result. +images+ is populated once +status+ is +"completed"+.
|
|
17
23
|
class TextToImageResponse < RunApi::Core::TaskResponse
|
|
18
24
|
required :id, String
|
|
19
25
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
@@ -21,6 +27,7 @@ module RunApi
|
|
|
21
27
|
optional :error, String
|
|
22
28
|
end
|
|
23
29
|
|
|
30
|
+
# Edit response -- same shape as generation.
|
|
24
31
|
EditImageResponse = TextToImageResponse
|
|
25
32
|
|
|
26
33
|
# Narrowed response returned by `run()` methods once polling observes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-gpt-image
|
|
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 gpt image api Ruby SDK is the language-specific package for GPT Image
|
|
27
27
|
on RunAPI. Use this gpt image api package for text-to-image, image editing, and
|
|
28
28
|
creative production flows when your application needs JSON request bodies, task
|