runapi-gpt-4o-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2472cd75263166ddf4f6f6dcbe222c458bae3ccfc1acd0c106e9a2ce42241b1f
4
- data.tar.gz: adaa442f974bf4101270ab1bbc057e95045594fdd0ec487d09edd60300729908
3
+ metadata.gz: fcb80b291743336ea11105108372ae8f5116811907b1a38fe6cc1e284ffc6b72
4
+ data.tar.gz: ef2b5b960ccb1d416975249bef34350f69e5940765b2f27130ad4d666bd94f4b
5
5
  SHA512:
6
- metadata.gz: 6471cd4c36028b46fc900d4d3236a8cd1f45eb14ad12aa343c6b8114ab89865a371769c9b57b215f94c5afd93ec873dc35dd32bde83fedfb6703c794d6843beb
7
- data.tar.gz: f5211a22702956fec1df59e764c4b3d7c45498b768f69673c08ce6c375f8eb36fe7e4534d01293aab469ee4c08e6ebab0838489c49631df4cbc13c72402699f4
6
+ metadata.gz: b2985e5a58b0a66ac18c6eae6e04d3ab31118338f1cffb8d7ded264e661a010b90c09a6a0a38da5f855bbea46e1f9eed58f4ae0502da1eab29e810f677d046fd
7
+ data.tar.gz: 56001d933cf766d533410f88edea4892fcdd7e75b1b5310699c94c7cf2ea7cd4abeffe20cbf6def298b4d3f721a782ca75d2cd8323c320b44caf57cd912f9c91
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::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.
@@ -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
 
@@ -2,15 +2,22 @@
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
9
+ # Required output aspect ratio.
7
10
  ASPECT_RATIOS = %w[1:1 3:2 2:3].freeze
11
+ # Batch sizes: 1, 2, or 4 images per request.
8
12
  OUTPUT_COUNTS = [1, 2, 4].freeze
9
13
 
14
+ # A generated image with its CDN URL.
10
15
  class Image < RunApi::Core::BaseModel
11
16
  optional :url, String
12
17
  end
13
18
 
19
+ # Response for GPT-4o Image tasks. Progress contains an intermediate
20
+ # status string while the task is running.
14
21
  class TextToImageResponse < RunApi::Core::TaskResponse
15
22
  required :id, String
16
23
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
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.5
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.5
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.5
25
+ version: 0.2.6
26
26
  description: The gpt-4o image api Ruby SDK is the language-specific package for GPT-4o
27
27
  Image on RunAPI. Use this gpt-4o image api package for text-to-image, image editing,
28
28
  and creative production flows when your application needs JSON request bodies, task