画像編集

Flux 3 Klein — edit

Flux 3 Klein — edit(画像編集)を MegaBrain API で:画像1枚あたり $0.0096。すべてのモデルに 1 つのキー、ドル建てのプリペイド残高から支払い、サブスクリプション不要。

black-forest-labs/flux-3-klein/edit
料金
$0.0096
画像1枚あたり

ジョブがキューに入った時点で差し引かれ、生成に失敗した場合は返金されます。

出力例

出力例:Flux 3 Klein — edit

ブラウザで試す

サインインすると、英語ページのプレイグラウンドで Flux 3 Klein — edit をブラウザから実行できます。料金は API と同じ残高から支払われます。

プレイグラウンドを開く

リクエストパラメータ

リクエストの JSON ボディのフィールドです。これ以外のフィールドは受け付けず、含めると 400 エラーになります。

  • prompt文字列必須
  • image_urlsURL のリスト必須
    最大 10 件
  • resolution文字列任意
    デフォルト:
    1K
    値:
    1K, 2K, 4K
  • aspect_ratio文字列任意
    デフォルト:
    auto
    値:
    1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 21:9, 9:21, auto
  • output_format文字列任意
    デフォルト:
    png
    値:
    png, jpeg, webp
  • seed整数任意
    範囲:
    0–2147483647
  • enhance_prompttrue / false任意
    デフォルト:
    true

API で使う

ジョブを送信し、status_url が COMPLETED になるまで確認してから、response_url で結果を取得します。同じキーと残高でテキストモデルも使えます。 API ドキュメント(英語)

curl

curl -X POST https://getmegabrain.com/api/gateway/v1/queue/black-forest-labs/flux-3-klein/edit \
  -H "Authorization: Bearer $MEGABRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a ceramic coffee mug on a sunlit oak table, product photo","image_urls":["https://example.com/photo.jpg"]}'

# Then poll status_url and fetch the result from response_url:
curl https://getmegabrain.com/api/gateway/v1/queue/requests/$REQUEST_ID -H "Authorization: Bearer $MEGABRAIN_API_KEY"

Python

import os, time, requests

BASE = "https://getmegabrain.com/api/gateway/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['MEGABRAIN_API_KEY']}"}

job = requests.post(f"{BASE}/queue/black-forest-labs/flux-3-klein/edit", headers=HEADERS, json={
  "prompt": "a ceramic coffee mug on a sunlit oak table, product photo",
  "image_urls": [
    "https://example.com/photo.jpg"
  ]
}).json()

while requests.get(job["status_url"], headers=HEADERS).json()["status"] not in ("COMPLETED", "FAILED"):
    time.sleep(2)

print(requests.get(job["response_url"], headers=HEADERS).json())

JavaScript

const BASE = 'https://getmegabrain.com/api/gateway/v1';
const headers = {
  Authorization: `Bearer ${process.env.MEGABRAIN_API_KEY}`,
  'Content-Type': 'application/json',
};

const job = await fetch(`${BASE}/queue/black-forest-labs/flux-3-klein/edit`, {
  method: 'POST',
  headers,
  body: JSON.stringify({
    "prompt": "a ceramic coffee mug on a sunlit oak table, product photo",
    "image_urls": [
      "https://example.com/photo.jpg"
    ]
  }),
}).then(r => r.json());

let status = job.status;
while (status !== 'COMPLETED' && status !== 'FAILED') {
  await new Promise(r => setTimeout(r, 2000));
  ({ status } = await fetch(job.status_url, { headers }).then(r => r.json()));
}
console.log(await fetch(job.response_url, { headers }).then(r => r.json()));

よくある質問

Flux 3 Klein — edit API の料金は?

画像1枚あたり $0.0096。 ドル建てのプリペイド残高から支払われ、失敗した生成は全額返金されます。サブスクリプションはありません。

Flux 3 Klein — edit を API で使うには?

MegaBrain の API キーを付けて POST https://getmegabrain.com/api/gateway/v1/queue/black-forest-labs/flux-3-klein/edit でジョブを送信し、status_url が COMPLETED になるまで確認してから、response_url で結果を取得します。同じキーと残高でテキストモデルも使えます。

コードを書かずに Flux 3 Klein — edit を試せますか?

はい。サインインすると、モデルの英語ページにあるプレイグラウンドで Flux 3 Klein — edit をブラウザから実行できます。料金は API と同じ残高から支払われます。

Flux 3 Klein — edit は入力画像を受け付けますか?

はい。元画像を image_urls(画像 URL のリスト)で渡し、編集内容をプロンプトに書きます。