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