kie-ruby 0.1.0 → 0.2.0

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/add-model.md +155 -0
  3. data/.claude/commands/release.md +118 -0
  4. data/.claude/commands/update-model.md +177 -0
  5. data/CLAUDE.md +1 -0
  6. data/README.md +137 -2
  7. data/docs/api/INDEX.md +12 -0
  8. data/docs/api/general/INDEX.md +59 -0
  9. data/docs/api/general/flux-2-flex-image-to-image.md +257 -0
  10. data/docs/api/general/flux-2-flex-text-to-image.md +237 -0
  11. data/docs/api/general/flux-2-pro-image-to-image.md +257 -0
  12. data/docs/api/general/grok-imagine-image-to-image.md +232 -0
  13. data/docs/api/general/grok-imagine-image-to-video.md +257 -0
  14. data/docs/api/general/grok-imagine-text-to-image.md +237 -0
  15. data/docs/api/general/grok-imagine-text-to-video.md +245 -0
  16. data/docs/api/general/grok-imagine-upscale.md +217 -0
  17. data/docs/api/general/nano-banana-pro.md +275 -0
  18. data/docs/api/general/seedream-4-5-edit.md +252 -0
  19. data/docs/api/general/seedream-4-5-text-to-image.md +245 -0
  20. data/docs/api/overview.md +92 -0
  21. data/docs/api/suno/INDEX.md +44 -0
  22. data/docs/api/suno/generate.md +154 -0
  23. data/docs/api/suno/models.md +95 -0
  24. data/docs/api/suno/task-status.md +150 -0
  25. data/docs/development/INDEX.md +1 -0
  26. data/docs/development/adding-new-model.md +195 -0
  27. data/docs/development/technical-design.md +2 -8
  28. data/lib/kie/models/flux_2_flex_image_to_image.rb +16 -0
  29. data/lib/kie/models/flux_2_flex_text_to_image.rb +15 -0
  30. data/lib/kie/models/flux_2_pro_image_to_image.rb +16 -0
  31. data/lib/kie/models/grok_imagine_image_to_image.rb +15 -0
  32. data/lib/kie/models/grok_imagine_image_to_video.rb +19 -0
  33. data/lib/kie/models/grok_imagine_text_to_image.rb +14 -0
  34. data/lib/kie/models/grok_imagine_text_to_video.rb +15 -0
  35. data/lib/kie/models/grok_imagine_upscale.rb +12 -0
  36. data/lib/kie/models/seedream_4_5_edit.rb +16 -0
  37. data/lib/kie/models/seedream_4_5_text_to_image.rb +15 -0
  38. data/lib/kie/version.rb +1 -1
  39. data/lib/kie.rb +10 -0
  40. metadata +33 -1
@@ -0,0 +1,257 @@
1
+ # Flux 2 Pro Image-to-Image API
2
+
3
+ Flux 2 Pro Image-to-Image 画像変換 API。
4
+
5
+ ## 概要
6
+
7
+ Flux 2 Pro Image-to-Image は参照画像に基づいて新しい画像を生成するモデル。1-8 枚の入力画像とテキストプロンプトを組み合わせて、画像を変換・生成する。
8
+
9
+ ## タスク作成
10
+
11
+ ### エンドポイント
12
+
13
+ ```
14
+ POST /api/v1/jobs/createTask
15
+ ```
16
+
17
+ ### リクエストパラメータ
18
+
19
+ #### トップレベル
20
+
21
+ | パラメータ | 型 | 必須 | 説明 |
22
+ |-----------|-----|------|------|
23
+ | `model` | string | Yes | `"flux-2/pro-image-to-image"` 固定 |
24
+ | `input` | object | Yes | 入力パラメータ |
25
+ | `callBackUrl` | string | No | タスク完了時の Webhook URL |
26
+
27
+ #### input オブジェクト
28
+
29
+ | パラメータ | 型 | 必須 | デフォルト | 説明 |
30
+ |-----------|-----|------|-----------|------|
31
+ | `prompt` | string | Yes | - | 変換指示(3-5,000 文字) |
32
+ | `input_urls` | array | Yes | - | 参照画像 URL(1-8 枚) |
33
+ | `aspect_ratio` | string | No | `"4:3"` | 出力アスペクト比 |
34
+ | `resolution` | string | No | `"1K"` | 出力解像度 |
35
+
36
+ ### aspect_ratio の値
37
+
38
+ | 値 | 説明 |
39
+ |----|------|
40
+ | `1:1` | 正方形 |
41
+ | `4:3` | 横長(4:3) |
42
+ | `3:4` | 縦長(3:4) |
43
+ | `16:9` | 横長(16:9、ワイドスクリーン) |
44
+ | `9:16` | 縦長(9:16、スマートフォン向け) |
45
+ | `3:2` | 横長(3:2、クラシック) |
46
+ | `2:3` | 縦長(2:3、クラシックポートレート) |
47
+ | `auto` | 最初の入力画像に合わせる |
48
+
49
+ ### resolution の値
50
+
51
+ | 値 | 説明 |
52
+ |----|------|
53
+ | `1K` | 1K 解像度(標準) |
54
+ | `2K` | 2K 解像度(高解像度) |
55
+
56
+ ### 入力画像の仕様
57
+
58
+ | 項目 | 制限 |
59
+ |------|------|
60
+ | 画像枚数 | 1-8 枚 |
61
+ | 最大ファイルサイズ | 10 MB / 枚 |
62
+ | 対応形式 | JPEG, PNG, WebP |
63
+
64
+ ### リクエスト例
65
+
66
+ #### 基本的な画像変換
67
+
68
+ ```json
69
+ {
70
+ "model": "flux-2/pro-image-to-image",
71
+ "input": {
72
+ "prompt": "Change the outfit to a formal suit",
73
+ "input_urls": [
74
+ "https://example.com/person.jpg"
75
+ ]
76
+ }
77
+ }
78
+ ```
79
+
80
+ #### 複数画像を参照した変換
81
+
82
+ ```json
83
+ {
84
+ "model": "flux-2/pro-image-to-image",
85
+ "input": {
86
+ "prompt": "Combine elements from both images into a new design",
87
+ "input_urls": [
88
+ "https://example.com/reference1.jpg",
89
+ "https://example.com/reference2.jpg"
90
+ ],
91
+ "aspect_ratio": "16:9",
92
+ "resolution": "2K"
93
+ },
94
+ "callBackUrl": "https://example.com/webhook"
95
+ }
96
+ ```
97
+
98
+ ### レスポンス
99
+
100
+ #### 成功時
101
+
102
+ ```json
103
+ {
104
+ "code": 200,
105
+ "msg": "success",
106
+ "data": {
107
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
108
+ }
109
+ }
110
+ ```
111
+
112
+ #### エラー時
113
+
114
+ ```json
115
+ {
116
+ "code": 400,
117
+ "msg": "Invalid parameters"
118
+ }
119
+ ```
120
+
121
+ ## タスクステータス取得
122
+
123
+ ### エンドポイント
124
+
125
+ ```
126
+ GET /api/v1/jobs/queryTask?taskId={taskId}
127
+ ```
128
+
129
+ ### クエリパラメータ
130
+
131
+ | パラメータ | 型 | 説明 |
132
+ |-----------|-----|------|
133
+ | `taskId` | string | タスク ID |
134
+
135
+ ### レスポンス
136
+
137
+ #### 成功時
138
+
139
+ ```json
140
+ {
141
+ "code": 200,
142
+ "msg": "success",
143
+ "data": {
144
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
145
+ "model": "flux-2/pro-image-to-image",
146
+ "state": "success",
147
+ "param": "{\"prompt\":\"...\",\"input_urls\":[...]}",
148
+ "resultJson": "{\"resultUrls\":[\"https://...\"]}",
149
+ "costTime": 15000,
150
+ "createTime": 1704067200000,
151
+ "completeTime": 1704067215000
152
+ }
153
+ }
154
+ ```
155
+
156
+ #### 処理中
157
+
158
+ ```json
159
+ {
160
+ "code": 200,
161
+ "msg": "success",
162
+ "data": {
163
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
164
+ "model": "flux-2/pro-image-to-image",
165
+ "state": "waiting"
166
+ }
167
+ }
168
+ ```
169
+
170
+ #### 失敗時
171
+
172
+ ```json
173
+ {
174
+ "code": 200,
175
+ "msg": "success",
176
+ "data": {
177
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
178
+ "model": "flux-2/pro-image-to-image",
179
+ "state": "fail",
180
+ "failCode": "CONTENT_POLICY_VIOLATION",
181
+ "failMsg": "The prompt violates content policy"
182
+ }
183
+ }
184
+ ```
185
+
186
+ ### タスクステータス
187
+
188
+ | ステータス | 説明 | 終了状態 |
189
+ |-----------|------|----------|
190
+ | `waiting` | 処理待ち | No |
191
+ | `success` | 完了 | Yes (成功) |
192
+ | `fail` | 失敗 | Yes (失敗) |
193
+
194
+ ### レスポンスフィールド
195
+
196
+ | フィールド | 型 | 説明 |
197
+ |-----------|-----|------|
198
+ | `taskId` | string | タスク ID |
199
+ | `model` | string | モデル名 |
200
+ | `state` | string | タスクステータス |
201
+ | `param` | string | リクエストパラメータ(JSON 文字列) |
202
+ | `resultJson` | string | 結果(JSON 文字列、成功時のみ) |
203
+ | `failCode` | string | エラーコード(失敗時) |
204
+ | `failMsg` | string | エラーメッセージ(失敗時) |
205
+ | `costTime` | integer | 処理時間(ミリ秒) |
206
+ | `createTime` | integer | 作成日時(Unix ミリ秒) |
207
+ | `completeTime` | integer | 完了日時(Unix ミリ秒) |
208
+
209
+ ## Ruby クライアントでの使用
210
+
211
+ ```ruby
212
+ client = Kie::Client.new(api_key: "your-api-key")
213
+
214
+ # 基本的な画像変換
215
+ task = client.general.generate(
216
+ model: "flux-2/pro-image-to-image",
217
+ input: {
218
+ prompt: "Transform this person into wearing a vintage dress",
219
+ input_urls: ["https://example.com/photo.jpg"]
220
+ }
221
+ )
222
+
223
+ # パラメータ指定
224
+ task = client.general.generate(
225
+ model: "flux-2/pro-image-to-image",
226
+ input: {
227
+ prompt: "Merge the styles of these two images",
228
+ input_urls: [
229
+ "https://example.com/style1.jpg",
230
+ "https://example.com/style2.jpg"
231
+ ]
232
+ },
233
+ aspect_ratio: "16:9",
234
+ resolution: "2K"
235
+ )
236
+
237
+ # 結果を取得
238
+ task.wait
239
+
240
+ if task.success?
241
+ image_url = task.urls.first
242
+ puts "Generated: #{image_url}"
243
+ else
244
+ puts "Failed: #{task.error_message}"
245
+ end
246
+ ```
247
+
248
+ ## コード参照
249
+
250
+ モデル定義は以下のファイルで管理されている:
251
+
252
+ - `lib/kie/models/flux_2_pro_image_to_image.rb`
253
+
254
+ ## 関連ドキュメント
255
+
256
+ - [API 共通仕様](../overview.md)
257
+ - [Seedream 4.5 Edit API](seedream-4-5-edit.md)
@@ -0,0 +1,232 @@
1
+ # Grok Imagine Image-to-Image API
2
+
3
+ Grok Imagine Image-to-Image 画像変換 API。
4
+
5
+ ## 概要
6
+
7
+ Grok Imagine Image-to-Image は入力画像とオプションのスタイル/コンテンツプロンプトに基づいて新しい画像を生成する画像変換モデル。シンプルな入力構造で、追加パラメータなしで使用可能。
8
+
9
+ ## タスク作成
10
+
11
+ ### エンドポイント
12
+
13
+ ```
14
+ POST /api/v1/jobs/createTask
15
+ ```
16
+
17
+ ### リクエストパラメータ
18
+
19
+ #### トップレベル
20
+
21
+ | パラメータ | 型 | 必須 | 説明 |
22
+ |-----------|-----|------|------|
23
+ | `model` | string | Yes | `"grok-imagine/image-to-image"` 固定 |
24
+ | `input` | object | Yes | 入力パラメータ |
25
+ | `callBackUrl` | string | No | タスク完了時の Webhook URL |
26
+
27
+ #### input オブジェクト
28
+
29
+ | パラメータ | 型 | 必須 | デフォルト | 説明 |
30
+ |-----------|-----|------|-----------|------|
31
+ | `prompt` | string | No | - | スタイル/コンテンツ指示(最大 390,000 文字) |
32
+ | `image_urls` | array | Yes | - | 入力画像 URL(1 枚) |
33
+
34
+ ### 入力画像の仕様
35
+
36
+ | 項目 | 制限 |
37
+ |------|------|
38
+ | 画像枚数 | 1 枚 |
39
+ | 最大ファイルサイズ | 10 MB |
40
+ | 対応形式 | JPEG, PNG, WebP |
41
+
42
+ ### リクエスト例
43
+
44
+ #### プロンプトなし(画像のみ)
45
+
46
+ ```json
47
+ {
48
+ "model": "grok-imagine/image-to-image",
49
+ "input": {
50
+ "image_urls": [
51
+ "https://example.com/source.jpg"
52
+ ]
53
+ }
54
+ }
55
+ ```
56
+
57
+ #### プロンプト付き
58
+
59
+ ```json
60
+ {
61
+ "model": "grok-imagine/image-to-image",
62
+ "input": {
63
+ "prompt": "Transform into a watercolor painting style",
64
+ "image_urls": [
65
+ "https://example.com/source.jpg"
66
+ ]
67
+ },
68
+ "callBackUrl": "https://example.com/webhook"
69
+ }
70
+ ```
71
+
72
+ ### レスポンス
73
+
74
+ #### 成功時
75
+
76
+ ```json
77
+ {
78
+ "code": 200,
79
+ "msg": "success",
80
+ "data": {
81
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
82
+ }
83
+ }
84
+ ```
85
+
86
+ #### エラー時
87
+
88
+ ```json
89
+ {
90
+ "code": 400,
91
+ "msg": "Invalid parameters"
92
+ }
93
+ ```
94
+
95
+ ## タスクステータス取得
96
+
97
+ ### エンドポイント
98
+
99
+ ```
100
+ GET /api/v1/jobs/queryTask?taskId={taskId}
101
+ ```
102
+
103
+ ### クエリパラメータ
104
+
105
+ | パラメータ | 型 | 説明 |
106
+ |-----------|-----|------|
107
+ | `taskId` | string | タスク ID |
108
+
109
+ ### レスポンス
110
+
111
+ #### 成功時
112
+
113
+ ```json
114
+ {
115
+ "code": 200,
116
+ "msg": "success",
117
+ "data": {
118
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
119
+ "model": "grok-imagine/image-to-image",
120
+ "state": "success",
121
+ "param": "{\"prompt\":\"...\",\"image_urls\":[...]}",
122
+ "resultJson": "{\"resultUrls\":[\"https://...\"]}",
123
+ "costTime": 15000,
124
+ "createTime": 1704067200000,
125
+ "completeTime": 1704067215000
126
+ }
127
+ }
128
+ ```
129
+
130
+ #### 処理中
131
+
132
+ ```json
133
+ {
134
+ "code": 200,
135
+ "msg": "success",
136
+ "data": {
137
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
138
+ "model": "grok-imagine/image-to-image",
139
+ "state": "waiting"
140
+ }
141
+ }
142
+ ```
143
+
144
+ #### 失敗時
145
+
146
+ ```json
147
+ {
148
+ "code": 200,
149
+ "msg": "success",
150
+ "data": {
151
+ "taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
152
+ "model": "grok-imagine/image-to-image",
153
+ "state": "fail",
154
+ "failCode": "CONTENT_POLICY_VIOLATION",
155
+ "failMsg": "The prompt violates content policy"
156
+ }
157
+ }
158
+ ```
159
+
160
+ ### タスクステータス
161
+
162
+ | ステータス | 説明 | 終了状態 |
163
+ |-----------|------|----------|
164
+ | `waiting` | 処理待ち | No |
165
+ | `success` | 完了 | Yes (成功) |
166
+ | `fail` | 失敗 | Yes (失敗) |
167
+
168
+ ### レスポンスフィールド
169
+
170
+ | フィールド | 型 | 説明 |
171
+ |-----------|-----|------|
172
+ | `taskId` | string | タスク ID |
173
+ | `model` | string | モデル名 |
174
+ | `state` | string | タスクステータス |
175
+ | `param` | string | リクエストパラメータ(JSON 文字列) |
176
+ | `resultJson` | string | 結果(JSON 文字列、成功時のみ) |
177
+ | `failCode` | string | エラーコード(失敗時) |
178
+ | `failMsg` | string | エラーメッセージ(失敗時) |
179
+ | `costTime` | integer | 処理時間(ミリ秒) |
180
+ | `createTime` | integer | 作成日時(Unix ミリ秒) |
181
+ | `completeTime` | integer | 完了日時(Unix ミリ秒) |
182
+
183
+ ## Ruby クライアントでの使用
184
+
185
+ ```ruby
186
+ client = Kie::Client.new(api_key: "your-api-key")
187
+
188
+ # シンプルな画像変換
189
+ task = client.general.generate(
190
+ model: "grok-imagine/image-to-image",
191
+ input: {
192
+ image_urls: ["https://example.com/photo.jpg"]
193
+ }
194
+ )
195
+
196
+ # プロンプト付き画像変換
197
+ task = client.general.generate(
198
+ model: "grok-imagine/image-to-image",
199
+ input: {
200
+ prompt: "Convert to anime style with vibrant colors",
201
+ image_urls: ["https://example.com/photo.jpg"]
202
+ }
203
+ )
204
+
205
+ # 結果を取得
206
+ task.wait
207
+
208
+ if task.success?
209
+ image_url = task.urls.first
210
+ puts "Generated: #{image_url}"
211
+ else
212
+ puts "Failed: #{task.error_message}"
213
+ end
214
+ ```
215
+
216
+ ## 注意事項
217
+
218
+ 1. **必須入力**: `image_urls` は必須パラメータ
219
+ 2. **単一画像**: 入力画像は 1 枚のみ
220
+ 3. **シンプル設計**: パラメータ(`aspect_ratio`, `resolution` 等)は不要
221
+ 4. **大容量プロンプト**: 最大 390,000 文字のプロンプトをサポート
222
+
223
+ ## コード参照
224
+
225
+ モデル定義は以下のファイルで管理されている:
226
+
227
+ - `lib/kie/models/grok_imagine_image_to_image.rb`
228
+
229
+ ## 関連ドキュメント
230
+
231
+ - [API 共通仕様](../overview.md)
232
+ - [Grok Imagine Image-to-Video API](grok-imagine-image-to-video.md)