runapi-gpt-image 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: d7077b69df98c9dabd0c94760877f1406f9359cc8aeaccbeecf82cb07faa677c
4
- data.tar.gz: 4ed9190bc5ee799a3be8194ff191c7d4331b17f0282e62dada30750436ce9135
3
+ metadata.gz: 5f0f24d53e5a9bb71de80a322a18692628ce317bd934ef4b940be87f7b89c214
4
+ data.tar.gz: 34900b290a2914977d76d8c436fd8f2cdd9486583bbf9e9f68d45b09059accee
5
5
  SHA512:
6
- metadata.gz: 8b07b7ca66c3c7307c9544cbc5493e67a1c241562f531aca037f5cd7a38cc7440827729d4c918d18a0b34bdf252a585d3aa73f174899994b3251a6e7ec4f6eb5
7
- data.tar.gz: c6d80eaf49c615d4172e8b277eb1c68bbd694f1898ef816bdc28e40e5c6fcd1d5bfacaf01c04d363e8a512baf94fdfdaafc848242ca90b9eabdc0dc1c83ca40c
6
+ metadata.gz: 607cb5ba0c1ab470b6851667c0cba9567a1ee79e3dcd314eeb5c76563f555fd861c5428fb5695045c98560d98a5c9ca4e1a05c120cd972c290d5df8d988a8db7
7
+ data.tar.gz: 26386b6c23a5a82143d3e9acc2ef9e28fd0340c35aade98202a819796c5ae3ec1f91f21f1788b17540207c276d567de8aaa1a71bcf895a78c2e0e2414f60cea3
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # GPT Image API Ruby SDK for RunAPI
2
+
3
+ The gpt image api Ruby SDK is the language-specific package for GPT Image on RunAPI. Use this gpt image 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 api README is the Ruby package guide inside the public `gpt-image-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/gpt-image; for API reference, use https://runapi.ai/docs#gpt-image; for SDK docs, use https://runapi.ai/docs#sdk-gpt-image.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ gem install runapi-gpt-image
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ ```ruby
16
+ require "runapi-gpt-image"
17
+
18
+ client = RunApi::GptImage::Client.new
19
+ task = client.generations.create(
20
+ # Pass the GPT Image JSON request body from https://runapi.ai/docs#gpt-image.
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::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.
30
+
31
+ ## Links
32
+
33
+ - Model page: https://runapi.ai/models/gpt-image
34
+ - SDK docs: https://runapi.ai/docs#sdk-gpt-image
35
+ - Product docs: https://runapi.ai/docs#gpt-image
36
+ - Pricing and rate limits: https://runapi.ai/models/gpt-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-sdk
40
+
41
+ ## License
42
+
43
+ Licensed under the Apache License, Version 2.0.
@@ -9,19 +9,19 @@ module RunApi
9
9
  #
10
10
  # # Text-to-image
11
11
  # result = client.text_to_image.run(
12
- # model: "gpt-image-1.5-text-to-image", prompt: "A futuristic cityscape"
12
+ # model: "gpt-image-1.5", prompt: "A futuristic cityscape"
13
13
  # )
14
14
  #
15
- # # Image-to-image
15
+ # # Edit image
16
16
  # edited = client.edit_image.run(
17
- # model: "gpt-image-1.5-image-to-image",
17
+ # model: "gpt-image-1.5",
18
18
  # prompt: "Transform into oil painting",
19
- # input_urls: ["https://example.com/photo.jpg"]
19
+ # source_image_urls: ["https://cdn.runapi.ai/public/samples/photo.jpg"]
20
20
  # )
21
21
  class Client
22
22
  # @return [Resources::TextToImage] Text-to-image generation operations.
23
23
  attr_reader :text_to_image
24
- # @return [Resources::EditImage] Image-to-image edit operations.
24
+ # @return [Resources::EditImage] Image edit operations.
25
25
  attr_reader :edit_image
26
26
 
27
27
  def initialize(api_key: nil, **options)
@@ -3,7 +3,7 @@
3
3
  module RunApi
4
4
  module GptImage
5
5
  module Resources
6
- # GPT Image 1.5 image-to-image edit resource.
6
+ # GPT Image 1.5 image edit resource.
7
7
  class EditImage
8
8
  include RunApi::Core::ResourceHelpers
9
9
 
@@ -25,7 +25,7 @@ module RunApi
25
25
  poll_until_complete { get(task.id) }
26
26
  end
27
27
 
28
- # Create an image-to-image edit task.
28
+ # Create an image editing task.
29
29
  #
30
30
  # @param params [Hash] edit parameters
31
31
  # @return [RunApi::GptImage::Types::EditImageResponse] task creation result with id
@@ -54,9 +54,9 @@ module RunApi
54
54
  raise Core::ValidationError, "Invalid model: #{model}. Must be: #{Types::EDIT_MODELS.join(", ")}"
55
55
  end
56
56
 
57
- urls = param(params, :input_urls)
57
+ urls = param(params, :source_image_urls)
58
58
  if urls.nil? || (urls.respond_to?(:empty?) && urls.empty?)
59
- raise Core::ValidationError, "input_urls is required for image-to-image models"
59
+ raise Core::ValidationError, "source_image_urls is required for image editing"
60
60
  end
61
61
 
62
62
  raise Core::ValidationError, "aspect_ratio is required" unless param(params, :aspect_ratio)
@@ -3,9 +3,9 @@
3
3
  module RunApi
4
4
  module GptImage
5
5
  module Types
6
- GENERATION_MODELS = %w[gpt-image-1.5-text-to-image].freeze
7
- EDIT_MODELS = %w[gpt-image-1.5-image-to-image].freeze
8
- MODELS = (GENERATION_MODELS + EDIT_MODELS).freeze
6
+ MODELS = %w[gpt-image-1.5].freeze
7
+ GENERATION_MODELS = MODELS
8
+ EDIT_MODELS = MODELS
9
9
 
10
10
  ASPECT_RATIOS = %w[1:1 2:3 3:2].freeze
11
11
  QUALITY_VALUES = %w[medium high].freeze
@@ -17,7 +17,7 @@ module RunApi
17
17
  class TextToImageResponse < RunApi::Core::TaskResponse
18
18
  required :id, String
19
19
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
20
- optional :images, [ -> { Image } ]
20
+ optional :images, [-> { Image }]
21
21
  optional :error, String
22
22
  end
23
23
 
@@ -27,7 +27,7 @@ module RunApi
27
27
  # `status: "completed"`. `images` is required so consumers never have to
28
28
  # null-check it on a successful task.
29
29
  class CompletedTextToImageResponse < TextToImageResponse
30
- required :images, [ -> { Image } ]
30
+ required :images, [-> { Image }]
31
31
  end
32
32
 
33
33
  CompletedEditImageResponse = CompletedTextToImageResponse
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
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 SDK for JavaScript, Ruby, and Go
25
+ version: 0.2.5
26
+ description: The gpt image api Ruby SDK is the language-specific package for GPT Image
27
+ on RunAPI. Use this gpt image api package for text-to-image, image editing, and
28
+ 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.rb
35
40
  - lib/runapi/gpt_image.rb
36
41
  - lib/runapi/gpt_image/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
45
- documentation_uri: https://github.com/runapi-ai/gpt-image-sdk/blob/main/README.md
50
+ documentation_uri: https://github.com/runapi-ai/gpt-image-sdk/blob/main/ruby/README.md
46
51
  source_code_uri: https://github.com/runapi-ai/gpt-image-sdk
47
52
  changelog_uri: https://github.com/runapi-ai/gpt-image-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 API SDKs for JavaScript, Ruby, and Go on RunAPI.
69
+ summary: GPT Image API Ruby SDK for RunAPI
65
70
  test_files: []