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,257 @@
|
|
|
1
|
+
# Flux 2 Flex Image-to-Image API
|
|
2
|
+
|
|
3
|
+
Flux 2 Flex Image-to-Image 画像変換 API。
|
|
4
|
+
|
|
5
|
+
## 概要
|
|
6
|
+
|
|
7
|
+
Flux 2 Flex 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/flex-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 | `"1:1"` | 出力アスペクト比 |
|
|
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/flex-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/flex-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/flex-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/flex-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/flex-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/flex-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/flex-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_flex_image_to_image.rb`
|
|
253
|
+
|
|
254
|
+
## 関連ドキュメント
|
|
255
|
+
|
|
256
|
+
- [API 共通仕様](../overview.md)
|
|
257
|
+
- [Flux 2 Pro Image-to-Image API](flux-2-pro-image-to-image.md)
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Flux 2 Flex Text-to-Image API
|
|
2
|
+
|
|
3
|
+
Flux 2 Flex Text-to-Image 画像生成 API。
|
|
4
|
+
|
|
5
|
+
## 概要
|
|
6
|
+
|
|
7
|
+
Flux 2 Flex Text-to-Image はテキストプロンプトから画像を生成するモデル。入力画像を必要としない純粋な text-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 | `"flux-2/flex-text-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
|
+
| `aspect_ratio` | string | No | `"1:1"` | 出力アスペクト比 |
|
|
33
|
+
| `resolution` | string | No | `"1K"` | 出力解像度 |
|
|
34
|
+
|
|
35
|
+
### aspect_ratio の値
|
|
36
|
+
|
|
37
|
+
| 値 | 説明 |
|
|
38
|
+
|----|------|
|
|
39
|
+
| `1:1` | 正方形 |
|
|
40
|
+
| `4:3` | 横長(4:3) |
|
|
41
|
+
| `3:4` | 縦長(3:4) |
|
|
42
|
+
| `16:9` | 横長(16:9、ワイドスクリーン) |
|
|
43
|
+
| `9:16` | 縦長(9:16、スマートフォン向け) |
|
|
44
|
+
| `3:2` | 横長(3:2、クラシック) |
|
|
45
|
+
| `2:3` | 縦長(2:3、クラシックポートレート) |
|
|
46
|
+
| `auto` | 自動(入力画像必要。text-to-image では使用非推奨) |
|
|
47
|
+
|
|
48
|
+
### resolution の値
|
|
49
|
+
|
|
50
|
+
| 値 | 説明 |
|
|
51
|
+
|----|------|
|
|
52
|
+
| `1K` | 1K 解像度(標準) |
|
|
53
|
+
| `2K` | 2K 解像度(高解像度) |
|
|
54
|
+
|
|
55
|
+
### リクエスト例
|
|
56
|
+
|
|
57
|
+
#### 基本的な画像生成
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"model": "flux-2/flex-text-to-image",
|
|
62
|
+
"input": {
|
|
63
|
+
"prompt": "A serene mountain landscape at sunset with golden light"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### パラメータ指定
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"model": "flux-2/flex-text-to-image",
|
|
73
|
+
"input": {
|
|
74
|
+
"prompt": "A futuristic cityscape with flying cars and neon lights",
|
|
75
|
+
"aspect_ratio": "16:9",
|
|
76
|
+
"resolution": "2K"
|
|
77
|
+
},
|
|
78
|
+
"callBackUrl": "https://example.com/webhook"
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### レスポンス
|
|
83
|
+
|
|
84
|
+
#### 成功時
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"code": 200,
|
|
89
|
+
"msg": "success",
|
|
90
|
+
"data": {
|
|
91
|
+
"taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### エラー時
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"code": 400,
|
|
101
|
+
"msg": "Invalid parameters"
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## タスクステータス取得
|
|
106
|
+
|
|
107
|
+
### エンドポイント
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
GET /api/v1/jobs/queryTask?taskId={taskId}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### クエリパラメータ
|
|
114
|
+
|
|
115
|
+
| パラメータ | 型 | 説明 |
|
|
116
|
+
|-----------|-----|------|
|
|
117
|
+
| `taskId` | string | タスク ID |
|
|
118
|
+
|
|
119
|
+
### レスポンス
|
|
120
|
+
|
|
121
|
+
#### 成功時
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"code": 200,
|
|
126
|
+
"msg": "success",
|
|
127
|
+
"data": {
|
|
128
|
+
"taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
|
129
|
+
"model": "flux-2/flex-text-to-image",
|
|
130
|
+
"state": "success",
|
|
131
|
+
"param": "{\"prompt\":\"...\"}",
|
|
132
|
+
"resultJson": "{\"resultUrls\":[\"https://...\"]}",
|
|
133
|
+
"costTime": 15000,
|
|
134
|
+
"createTime": 1704067200000,
|
|
135
|
+
"completeTime": 1704067215000
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### 処理中
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"code": 200,
|
|
145
|
+
"msg": "success",
|
|
146
|
+
"data": {
|
|
147
|
+
"taskId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
|
148
|
+
"model": "flux-2/flex-text-to-image",
|
|
149
|
+
"state": "waiting"
|
|
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": "flux-2/flex-text-to-image",
|
|
163
|
+
"state": "fail",
|
|
164
|
+
"failCode": "CONTENT_POLICY_VIOLATION",
|
|
165
|
+
"failMsg": "The prompt violates content policy"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### タスクステータス
|
|
171
|
+
|
|
172
|
+
| ステータス | 説明 | 終了状態 |
|
|
173
|
+
|-----------|------|----------|
|
|
174
|
+
| `waiting` | 処理待ち | No |
|
|
175
|
+
| `success` | 完了 | Yes (成功) |
|
|
176
|
+
| `fail` | 失敗 | Yes (失敗) |
|
|
177
|
+
|
|
178
|
+
### レスポンスフィールド
|
|
179
|
+
|
|
180
|
+
| フィールド | 型 | 説明 |
|
|
181
|
+
|-----------|-----|------|
|
|
182
|
+
| `taskId` | string | タスク ID |
|
|
183
|
+
| `model` | string | モデル名 |
|
|
184
|
+
| `state` | string | タスクステータス |
|
|
185
|
+
| `param` | string | リクエストパラメータ(JSON 文字列) |
|
|
186
|
+
| `resultJson` | string | 結果(JSON 文字列、成功時のみ) |
|
|
187
|
+
| `failCode` | string | エラーコード(失敗時) |
|
|
188
|
+
| `failMsg` | string | エラーメッセージ(失敗時) |
|
|
189
|
+
| `costTime` | integer | 処理時間(ミリ秒) |
|
|
190
|
+
| `createTime` | integer | 作成日時(Unix ミリ秒) |
|
|
191
|
+
| `completeTime` | integer | 完了日時(Unix ミリ秒) |
|
|
192
|
+
|
|
193
|
+
## Ruby クライアントでの使用
|
|
194
|
+
|
|
195
|
+
```ruby
|
|
196
|
+
client = Kie::Client.new(api_key: "your-api-key")
|
|
197
|
+
|
|
198
|
+
# 基本的な画像生成
|
|
199
|
+
task = client.general.generate(
|
|
200
|
+
model: "flux-2/flex-text-to-image",
|
|
201
|
+
input: {
|
|
202
|
+
prompt: "A beautiful sunset over the ocean with vibrant colors"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
# パラメータ指定
|
|
207
|
+
task = client.general.generate(
|
|
208
|
+
model: "flux-2/flex-text-to-image",
|
|
209
|
+
input: {
|
|
210
|
+
prompt: "An astronaut riding a horse on Mars"
|
|
211
|
+
},
|
|
212
|
+
aspect_ratio: "16:9",
|
|
213
|
+
resolution: "2K"
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# 結果を取得
|
|
217
|
+
task.wait
|
|
218
|
+
|
|
219
|
+
if task.success?
|
|
220
|
+
image_url = task.urls.first
|
|
221
|
+
puts "Generated: #{image_url}"
|
|
222
|
+
else
|
|
223
|
+
puts "Failed: #{task.error_message}"
|
|
224
|
+
end
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## コード参照
|
|
228
|
+
|
|
229
|
+
モデル定義は以下のファイルで管理されている:
|
|
230
|
+
|
|
231
|
+
- `lib/kie/models/flux_2_flex_text_to_image.rb`
|
|
232
|
+
|
|
233
|
+
## 関連ドキュメント
|
|
234
|
+
|
|
235
|
+
- [API 共通仕様](../overview.md)
|
|
236
|
+
- [Flux 2 Flex Image-to-Image API](flux-2-flex-image-to-image.md)
|
|
237
|
+
- [Flux 2 Pro Image-to-Image API](flux-2-pro-image-to-image.md)
|