runapi-gpt-image-2 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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93e24a0cc8419599b2adea4066cf690d2181f89e2b2644834373e971d542f38d
|
|
4
|
+
data.tar.gz: 7389dcf5a964ca44a6ecc6a377d1b989711503df69a267815ca41a0388691ae3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e0439329c6d4f35c72539f1f6fae4ed3a8948e0a848f2a3ca14451632f9e50a119491251c4c3c21fe1ff77cba5c087374ee56ac3d6cbb4301abc94228025516
|
|
7
|
+
data.tar.gz: 197a2fb299f84efa8a5a004765913658cc7112dade20daa15f1b1e4a53a6c712d3bb102dcc1d4903326d5bf707a9168f7c4631687869dc43f53d0017eaa6e990
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# GPT Image 2 API Ruby SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
The gpt image 2 api Ruby SDK is the language-specific package for GPT Image 2 on RunAPI. Use this gpt image 2 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 gpt image 2 api README is the Ruby package guide inside the public `gpt-image-2-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/gpt-image-2; for API reference, use https://runapi.ai/docs#gpt-image-2; for SDK docs, use https://runapi.ai/docs#sdk-gpt-image-2.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install runapi-gpt-image-2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "runapi-gpt-image-2"
|
|
17
|
+
|
|
18
|
+
client = RunApi::GptImage2::Client.new
|
|
19
|
+
task = client.generations.create(
|
|
20
|
+
# Pass the GPT Image 2 JSON request body from https://runapi.ai/docs#gpt-image-2.
|
|
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
|
+
## Language notes
|
|
28
|
+
|
|
29
|
+
Use Ruby keyword arguments and the `RunApi::GptImage2` 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.
|
|
30
|
+
|
|
31
|
+
## Links
|
|
32
|
+
|
|
33
|
+
- Model page: https://runapi.ai/models/gpt-image-2
|
|
34
|
+
- SDK docs: https://runapi.ai/docs#sdk-gpt-image-2
|
|
35
|
+
- Product docs: https://runapi.ai/docs#gpt-image-2
|
|
36
|
+
- Pricing and rate limits: https://runapi.ai/models/gpt-image-2/text-to-image
|
|
37
|
+
- Provider comparison: https://runapi.ai/providers/openai
|
|
38
|
+
- Full catalog: https://runapi.ai/models
|
|
39
|
+
- Repository: https://github.com/runapi-ai/gpt-image-2-sdk
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -41,12 +41,13 @@ module RunApi
|
|
|
41
41
|
raise Core::ValidationError, "Invalid model: #{model}. Must be: #{Types::EDIT_MODELS.join(", ")}"
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
urls = param(params, :
|
|
44
|
+
urls = param(params, :source_image_urls)
|
|
45
45
|
if urls.nil? || (urls.respond_to?(:empty?) && urls.empty?)
|
|
46
|
-
raise Core::ValidationError, "
|
|
46
|
+
raise Core::ValidationError, "source_image_urls is required for edit image requests"
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
50
|
+
validate_optional!(params, :output_resolution, Types::RESOLUTIONS)
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
end
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module GptImage2
|
|
5
5
|
module Types
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
MODELS = %w[gpt-image-2].freeze
|
|
7
|
+
GENERATION_MODELS = MODELS
|
|
8
|
+
EDIT_MODELS = MODELS
|
|
9
9
|
|
|
10
|
-
ASPECT_RATIOS = %w[auto 1:1
|
|
10
|
+
ASPECT_RATIOS = %w[auto 1:1 9:16 16:9 4:3 3:4].freeze
|
|
11
|
+
RESOLUTIONS = %w[1k 2k 4k].freeze
|
|
11
12
|
|
|
12
13
|
class Image < RunApi::Core::BaseModel
|
|
13
14
|
optional :url, String
|
|
@@ -16,14 +17,14 @@ module RunApi
|
|
|
16
17
|
class TextToImageResponse < RunApi::Core::TaskResponse
|
|
17
18
|
required :id, String
|
|
18
19
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
19
|
-
optional :images, [
|
|
20
|
+
optional :images, [-> { Image }]
|
|
20
21
|
optional :error, String
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
EditImageResponse = TextToImageResponse
|
|
24
25
|
|
|
25
26
|
class CompletedTextToImageResponse < TextToImageResponse
|
|
26
|
-
required :images, [
|
|
27
|
+
required :images, [-> { Image }]
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
CompletedEditImageResponse = CompletedTextToImageResponse
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-gpt-image-2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
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.
|
|
18
|
+
version: 0.2.5
|
|
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.
|
|
26
|
-
description:
|
|
25
|
+
version: 0.2.5
|
|
26
|
+
description: The gpt image 2 api Ruby SDK is the language-specific package for GPT
|
|
27
|
+
Image 2 on RunAPI. Use this gpt image 2 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-gpt_image_2.rb
|
|
35
40
|
- lib/runapi/gpt_image_2.rb
|
|
36
41
|
- lib/runapi/gpt_image_2/client.rb
|
|
@@ -42,7 +47,7 @@ licenses:
|
|
|
42
47
|
- Apache-2.0
|
|
43
48
|
metadata:
|
|
44
49
|
homepage_uri: https://runapi.ai/models/gpt-image-2
|
|
45
|
-
documentation_uri: https://github.com/runapi-ai/gpt-image-2-sdk/blob/main/README.md
|
|
50
|
+
documentation_uri: https://github.com/runapi-ai/gpt-image-2-sdk/blob/main/ruby/README.md
|
|
46
51
|
source_code_uri: https://github.com/runapi-ai/gpt-image-2-sdk
|
|
47
52
|
changelog_uri: https://github.com/runapi-ai/gpt-image-2-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: GPT Image 2 API
|
|
69
|
+
summary: GPT Image 2 API Ruby SDK for RunAPI
|
|
65
70
|
test_files: []
|