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: bc6c0a3f30021b0e9e5de2228d900e90cdd83ae1978741267c9fc47f208c5d44
4
- data.tar.gz: d8f8942ed6b2ce27c34c382fec419875208c5d5f5e4a34c9b454a016b8f93c1d
3
+ metadata.gz: 93e24a0cc8419599b2adea4066cf690d2181f89e2b2644834373e971d542f38d
4
+ data.tar.gz: 7389dcf5a964ca44a6ecc6a377d1b989711503df69a267815ca41a0388691ae3
5
5
  SHA512:
6
- metadata.gz: 6ceb52e828549b8a8bf98d45e414eaa6c52cb32f43eac704f0af8f03b7d8bdf2a6f853238b7d74a80eed8a1c0ed076af1836ae23ca0d8db942aa959363bee230
7
- data.tar.gz: 01c7f6ffaf3f86f02bcbb79b46a21eede90144971839ec512f896149fc95850d0d6beffefbd8baabe00194c18dea73e5db07ae33408c951faec6c7754c7bab1c
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, :input_urls)
44
+ urls = param(params, :source_image_urls)
45
45
  if urls.nil? || (urls.respond_to?(:empty?) && urls.empty?)
46
- raise Core::ValidationError, "input_urls is required for image-to-image models"
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
@@ -42,6 +42,7 @@ module RunApi
42
42
  end
43
43
 
44
44
  validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
45
+ validate_optional!(params, :output_resolution, Types::RESOLUTIONS)
45
46
  end
46
47
  end
47
48
  end
@@ -3,11 +3,12 @@
3
3
  module RunApi
4
4
  module GptImage2
5
5
  module Types
6
- GENERATION_MODELS = %w[gpt-image-2-text-to-image].freeze
7
- EDIT_MODELS = %w[gpt-image-2-image-to-image].freeze
8
- MODELS = (GENERATION_MODELS + EDIT_MODELS).freeze
6
+ MODELS = %w[gpt-image-2].freeze
7
+ GENERATION_MODELS = MODELS
8
+ EDIT_MODELS = MODELS
9
9
 
10
- ASPECT_RATIOS = %w[auto 1:1 5:4 9:16 21:9 16:9 4:3 3:2 4:5 3:4 2:3].freeze
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, [ -> { Image } ]
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, [ -> { Image } ]
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
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.4
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.4
26
- description: RunAPI GPT Image 2 SDK for JavaScript, Ruby, and Go
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 SDKs for JavaScript, Ruby, and Go on RunAPI.
69
+ summary: GPT Image 2 API Ruby SDK for RunAPI
65
70
  test_files: []