runapi-gpt-4o-image 0.2.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e67bec430137ebcd7f223ac43481d3a80d26720490b9f3a73c5de0aec5934bbf
4
- data.tar.gz: 55c388c3d12c333e1bf9eebc33847bad30a8751ad8ecdeb915ff7fdb026d1788
3
+ metadata.gz: fcb80b291743336ea11105108372ae8f5116811907b1a38fe6cc1e284ffc6b72
4
+ data.tar.gz: ef2b5b960ccb1d416975249bef34350f69e5940765b2f27130ad4d666bd94f4b
5
5
  SHA512:
6
- metadata.gz: f28753e09bd6b3eec8db927000e3529767411f4ff21ebdf53ecc166a5c1369f5e078b4ea0a6c7f1ad7679a1e726afa1699df1bf8fee86b0ba6114b1cb61e925b
7
- data.tar.gz: 57367a8847e2187baa587dbfe732bd7a34f264675f0e2709db6b9b8b180f274587e16e679aed1c70aad1fe4d476d451239aa62ddd3113af53deff66344916b1f
6
+ metadata.gz: b2985e5a58b0a66ac18c6eae6e04d3ab31118338f1cffb8d7ded264e661a010b90c09a6a0a38da5f855bbea46e1f9eed58f4ae0502da1eab29e810f677d046fd
7
+ data.tar.gz: 56001d933cf766d533410f88edea4892fcdd7e75b1b5310699c94c7cf2ea7cd4abeffe20cbf6def298b4d3f721a782ca75d2cd8323c320b44caf57cd912f9c91
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # GPT-4o Image API Ruby SDK for RunAPI
2
+
3
+ The gpt-4o image api Ruby SDK is the language-specific package for GPT-4o Image on RunAPI. Use this gpt-4o 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-4o image api README is the Ruby package guide inside the public `gpt4o-image-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/gpt-4o-image; for API reference, use https://runapi.ai/docs#gpt-4o-image; for SDK docs, use https://runapi.ai/docs#sdk-gpt-4o-image.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ gem install runapi-gpt4o-image
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ ```ruby
16
+ require "runapi-gpt4o-image"
17
+
18
+ client = RunApi::Gpt4oImage::Client.new
19
+ task = client.generations.create(
20
+ # Pass the GPT-4o Image JSON request body from https://runapi.ai/docs#gpt-4o-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
+ 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
+
29
+ ## Language notes
30
+
31
+ Use Ruby keyword arguments and the `RunApi::Gpt4oImage` error classes when building image jobs, Rails workers, or scripts. The available resources include generations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
32
+
33
+ ## Links
34
+
35
+ - Model page: https://runapi.ai/models/gpt-4o-image
36
+ - SDK docs: https://runapi.ai/docs#sdk-gpt-4o-image
37
+ - Product docs: https://runapi.ai/docs#gpt-4o-image
38
+ - Pricing and rate limits: https://runapi.ai/models/gpt-4o-image
39
+ - Provider comparison: https://runapi.ai/providers/openai
40
+ - Full catalog: https://runapi.ai/models
41
+ - Repository: https://github.com/runapi-ai/gpt4o-image-sdk
42
+
43
+ ## License
44
+
45
+ Licensed under the Apache License, Version 2.0.
@@ -2,14 +2,32 @@
2
2
 
3
3
  module RunApi
4
4
  module Gpt4oImage
5
- class Client
5
+ # GPT-4o Image generation and editing API client.
6
+ #
7
+ # Supports pure text-to-image generation, image editing with source images,
8
+ # and inpainting with an optional mask.
9
+ #
10
+ # @example
11
+ # client = RunApi::Gpt4oImage::Client.new(api_key: "your-api-key")
12
+ #
13
+ # # Pure generation
14
+ # result = client.text_to_image.run(
15
+ # model: "gpt-4o-image", prompt: "A mountain lake at dawn",
16
+ # aspect_ratio: "3:2"
17
+ # )
18
+ #
19
+ # # Edit with source images
20
+ # edited = client.text_to_image.run(
21
+ # model: "gpt-4o-image", prompt: "Add a rainbow",
22
+ # aspect_ratio: "3:2",
23
+ # source_image_urls: ["https://example.com/photo.jpg"]
24
+ # )
25
+ class Client < RunApi::Core::Client
26
+ # @return [Resources::TextToImage] Image generation and editing operations.
6
27
  attr_reader :text_to_image
7
28
 
8
29
  def initialize(api_key: nil, **options)
9
- @api_key = Core::Auth.resolve_api_key(api_key)
10
-
11
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
12
- http = client_options.http_client || Core::HttpClient.new(client_options)
30
+ super
13
31
  @text_to_image = Resources::TextToImage.new(http)
14
32
  end
15
33
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module Gpt4oImage
5
5
  module Resources
6
+ # GPT-4o Image generation and editing resource.
7
+ # Generate images from text, edit with source images, or inpaint with a mask.
6
8
  class TextToImage
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -34,16 +36,15 @@ module RunApi
34
36
 
35
37
  def validate_params!(params)
36
38
  raise Core::ValidationError, "model is required" unless param(params, :model)
37
- raise Core::ValidationError, "size is required" unless param(params, :size)
39
+ raise Core::ValidationError, "aspect_ratio is required" unless param(params, :aspect_ratio)
38
40
 
39
41
  model = param(params, :model)
40
42
  unless Types::MODELS.include?(model)
41
43
  raise Core::ValidationError, "Invalid model: #{model}. Must be: #{Types::MODELS.join(", ")}"
42
44
  end
43
45
 
44
- validate_optional!(params, :size, Types::SIZES)
45
- validate_optional!(params, :n_variants, Types::N_VARIANTS)
46
- validate_optional!(params, :fallback_model, Types::FALLBACK_MODELS)
46
+ validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
47
+ validate_optional!(params, :output_count, Types::OUTPUT_COUNTS)
47
48
  end
48
49
  end
49
50
  end
@@ -2,20 +2,26 @@
2
2
 
3
3
  module RunApi
4
4
  module Gpt4oImage
5
+ # GPT-4o Image type constants and response models.
6
+ # Supports pure generation, editing with source images, and inpainting with a mask.
5
7
  module Types
6
8
  MODELS = %w[gpt-4o-image].freeze
7
- SIZES = %w[1:1 3:2 2:3].freeze
8
- FALLBACK_MODELS = %w[GPT_IMAGE_1 FLUX_MAX].freeze
9
- N_VARIANTS = [ 1, 2, 4 ].freeze
9
+ # Required output aspect ratio.
10
+ ASPECT_RATIOS = %w[1:1 3:2 2:3].freeze
11
+ # Batch sizes: 1, 2, or 4 images per request.
12
+ OUTPUT_COUNTS = [1, 2, 4].freeze
10
13
 
14
+ # A generated image with its CDN URL.
11
15
  class Image < RunApi::Core::BaseModel
12
16
  optional :url, String
13
17
  end
14
18
 
19
+ # Response for GPT-4o Image tasks. Progress contains an intermediate
20
+ # status string while the task is running.
15
21
  class TextToImageResponse < RunApi::Core::TaskResponse
16
22
  required :id, String
17
23
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
18
- optional :images, [ -> { Image } ]
24
+ optional :images, [-> { Image }]
19
25
  optional :progress, String
20
26
  optional :error, String
21
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-gpt-4o-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
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.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.4
26
- description: RunAPI GPT-4o Image SDK for JavaScript, Ruby, and Go
25
+ version: 0.2.6
26
+ description: The gpt-4o image api Ruby SDK is the language-specific package for GPT-4o
27
+ Image on RunAPI. Use this gpt-4o image 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_4o_image.rb
35
40
  - lib/runapi/gpt_4o_image.rb
36
41
  - lib/runapi/gpt_4o_image/client.rb
@@ -41,7 +46,7 @@ licenses:
41
46
  - Apache-2.0
42
47
  metadata:
43
48
  homepage_uri: https://runapi.ai/models/gpt-4o-image
44
- documentation_uri: https://github.com/runapi-ai/gpt-4o-image-sdk/blob/main/README.md
49
+ documentation_uri: https://github.com/runapi-ai/gpt-4o-image-sdk/blob/main/ruby/README.md
45
50
  source_code_uri: https://github.com/runapi-ai/gpt-4o-image-sdk
46
51
  changelog_uri: https://github.com/runapi-ai/gpt-4o-image-sdk/blob/main/CHANGELOG.md
47
52
  rdoc_options: []
@@ -60,5 +65,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
65
  requirements: []
61
66
  rubygems_version: 4.0.10
62
67
  specification_version: 4
63
- summary: GPT-4o Image API SDKs for JavaScript, Ruby, and Go on RunAPI.
68
+ summary: GPT-4o Image API Ruby SDK for RunAPI
64
69
  test_files: []