runapi-seedance 0.2.6 → 0.2.7

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: 4118e285fccee6a45c55c4a823d935bb75d7cca1cfe5dfc4e82973214575c183
4
- data.tar.gz: 6ca91fe558e2a4e53890b21d573b4809dc2af0335cce7f35baabde7797c54fec
3
+ metadata.gz: 4a4129f28a6815e05d711bf3c21304a59cc6f9d5250ba3c4efec1126a72227b5
4
+ data.tar.gz: 997e90de2aa928d79bbfe267a05d267d842137056f5beb470b1d2646254bec70
5
5
  SHA512:
6
- metadata.gz: 0074a40fc6a32db226f372d2575aa2db218d3c0ec5b7abe2d3a6ffc1a9f962e5a137e7d03ab8ee714f80c6377180d88aed4899d513f84b008991452bc888c1b5
7
- data.tar.gz: '06799aaa55a72f75efdef4e17311297e96c7a73b53bbfa1856157be770066adb09edc70128b9db546fe301359b8fd6eae7f84ec34d3251de19447568b340593d'
6
+ metadata.gz: e2b7f49b273915dabdca3e14b02eac8ae58733f5f4cea8c53a2b6b2ce5dcbc58a3c3e961304eadbfb32dbe1d5358585c399ef0b029a1b47c062a35a7f06485e0
7
+ data.tar.gz: b7c7f737b22359c3808c02bda601abcb2c7bc7155acf05b769813ba281d26dd242f3428ddc6a228b5983358c9bc0e2b26168328f5d1de8af414512ff64f636e3
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::Seedance` error classes when building video 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.
@@ -9,15 +9,12 @@ module RunApi
9
9
  # result = client.text_to_video.run(
10
10
  # model: "seedance-2.0", prompt: "A cat walking through a garden"
11
11
  # )
12
- class Client
12
+ class Client < RunApi::Core::Client
13
13
  # @return [Resources::TextToVideo] Video generation operations.
14
14
  attr_reader :text_to_video
15
15
 
16
16
  def initialize(api_key: nil, **options)
17
- @api_key = Core::Auth.resolve_api_key(api_key)
18
-
19
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
20
- http = client_options.http_client || Core::HttpClient.new(client_options)
17
+ super
21
18
  @text_to_video = Resources::TextToVideo.new(http)
22
19
  end
23
20
  end
@@ -2,43 +2,72 @@
2
2
 
3
3
  module RunApi
4
4
  module Seedance
5
+ # Type definitions and constants for Seedance video generation.
6
+ #
7
+ # Constants are grouped by model generation: 1.5, 2.0/2.0-fast, and V1.
8
+ # Each generation has its own aspect ratio, resolution, and duration
9
+ # constraints reflecting different rendering capabilities.
5
10
  module Types
11
+ # V1-generation model identifiers: lite (low-cost), pro (high-quality), and pro-fast (speed-optimized).
6
12
  V1_MODELS = %w[seedance-v1-lite seedance-v1-pro seedance-v1-pro-fast].freeze
13
+ # All supported model variants spanning 1.5, 2.0, and V1 generations.
7
14
  MODELS = (%w[seedance-1.5-pro seedance-2.0 seedance-2.0-fast] + V1_MODELS).freeze
8
15
 
16
+ # Aspect ratios for seedance-1.5-pro; required with every request.
9
17
  ASPECT_RATIOS_1_5 = %w[1:1 4:3 3:4 16:9 9:16 21:9].freeze
18
+ # Aspect ratios for 2.0/2.0-fast; includes "auto" for automatic selection.
10
19
  ASPECT_RATIOS_2 = [*ASPECT_RATIOS_1_5, "auto"].freeze
20
+ # Aspect ratios for seedance-v1-lite; uses 9:21 (not 21:9) for tall portrait.
11
21
  ASPECT_RATIOS_V1_LITE = %w[1:1 4:3 3:4 16:9 9:16 9:21].freeze
22
+ # Aspect ratios for seedance-v1-pro and seedance-v1-pro-fast.
12
23
  ASPECT_RATIOS_V1_PRO = %w[1:1 4:3 3:4 16:9 9:16 21:9].freeze
13
24
 
25
+ # Output resolutions for seedance-1.5-pro.
14
26
  RESOLUTIONS_1_5 = %w[480p 720p 1080p].freeze
27
+ # Output resolutions for seedance-2.0.
15
28
  RESOLUTIONS_SEEDANCE_2 = %w[480p 720p 1080p].freeze
29
+ # Output resolutions for seedance-2.0-fast; capped at 720p for faster rendering.
16
30
  RESOLUTIONS_SEEDANCE_2_FAST = %w[480p 720p].freeze
31
+ # Output resolutions for seedance-v1-lite and seedance-v1-pro.
17
32
  RESOLUTIONS_V1 = %w[480p 720p 1080p].freeze
33
+ # Output resolutions for seedance-v1-pro-fast; minimum 720p.
18
34
  RESOLUTIONS_V1_PRO_FAST = %w[720p 1080p].freeze
19
35
 
36
+ # Allowed duration values (seconds) for seedance-1.5-pro; discrete choices only.
20
37
  DURATIONS_1_5 = [4, 8, 12].freeze
38
+ # Continuous duration range (seconds) for 2.0/2.0-fast; any integer 4-15 is accepted.
21
39
  DURATION_2_RANGE = (4..15)
40
+ # Allowed duration values (seconds) for V1 models; 5 or 10.
22
41
  DURATIONS_V1 = [5, 10].freeze
42
+ # Valid seed range; -1 requests a random seed.
23
43
  SEED_RANGE = (-1..2_147_483_647)
24
44
 
45
+ # Minimum prompt length in characters, enforced across all models.
25
46
  PROMPT_MIN_LENGTH = 3
47
+ # Maximum prompt length for seedance-1.5-pro.
26
48
  PROMPT_MAX_LENGTH_1_5 = 2500
49
+ # Maximum prompt length for 2.0/2.0-fast (up to 20 000 characters).
27
50
  PROMPT_MAX_LENGTH_2 = 20000
51
+ # Maximum prompt length for V1 models (up to 10 000 characters).
28
52
  PROMPT_MAX_LENGTH_V1 = 10000
29
53
 
54
+ # Fields that specify first/last frame images for frame-conditioned generation.
30
55
  FRAME_FIELDS = %i[first_frame_image_url last_frame_image_url].freeze
56
+ # Fields for reference-conditioned generation (images, videos, and audio).
31
57
  REFERENCE_FIELDS = %i[reference_image_urls reference_video_urls reference_audio_urls].freeze
32
58
 
59
+ # A single generated video with its download URL.
33
60
  class Video < RunApi::Core::BaseModel
34
61
  optional :url, String
35
62
  end
36
63
 
64
+ # Base async response returned immediately after task creation and during polling.
37
65
  class AsyncTaskResponse < RunApi::Core::TaskResponse
38
66
  required :id, String
39
67
  optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
40
68
  end
41
69
 
70
+ # Full response for a text-to-video task, including generated videos on completion.
42
71
  class TextToVideoResponse < AsyncTaskResponse
43
72
  optional :videos, [-> { Video }]
44
73
  optional :last_frame_image_url, String
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-seedance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
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 seedance api Ruby SDK is the language-specific package for Seedance
27
27
  on RunAPI. Use this seedance api package for text-to-video, image-to-video, video
28
28
  editing, and animation flows when your application needs JSON request bodies, task