> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aireiter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FLUX 3 Klein 画像生成

> - 非同期処理モード、後続のクエリに使用するタスクIDを返却
- Black Forest Labs が 2026年10月にリリースした FLUX 3 Image 軽量オープンソースウェイト版（5.6B パラメータ）。高速な画像編集を主力とし、テキストからの画像生成にも対応
- テキストからの画像生成および画像からの画像生成に対応、image_url を渡すと自動的に画像からの画像生成に切り替え
- 最大3枚のリファレンス画像に対応、1枚目は編集対象の画像、残りは被写体・商品・スタイルの参考を提供
- 生成前にプロンプトを自動拡張
- 7種類の一般的な画像比率に対応
- 1K / 2K 解像度に対応、1回につき最大4枚まで生成可能
- 送信された prompt はプラットフォームのセンシティブワード／セキュリティ審査を受け、違反コンテンツは直接拒否されます


## Authorizations

**Authorization** `string` *required*

すべてのAPIで Bearer Token による認証が必要です。

API Key の取得：

[API Key 管理ページ](https://aireiter.com/keys)にアクセスして API Key を取得してください。

使用時はリクエストヘッダーに以下を追加します：

```
Authorization: Bearer YOUR_API_KEY
```

## Body

**model** `string` *required*

モデル名。

固定値：`"flux_3_klein"`

**params** `object` *required*

モデルパラメータオブジェクト。

**params オブジェクトのプロパティ**

**prompt** `string` *required*

画像生成または編集の指示。最大4000文字。

* 中国語と英語に対応。被写体、シーン、構図、ライティング、質感、保持したい参照画像の特徴を明確に記述することを推奨します
* 画像から画像を生成（Image-to-Image）する場合、プロンプト内で保持する内容と変更する内容を明確に記述してください
* モデルは生成前にプロンプトを自動拡張するため、意図を明確に記述するだけでよく、修飾語を過剰に重ねる必要はありません
* 送信前にプラットフォームの不適切ワード／セキュリティ審査が行われ、規約違反に該当する場合は直接エラーが返されます

**image\_url** `string[]`

参照画像配列。渡された場合は自動的に Image-to-Image モードが使用され、指定しない場合は Text-to-Image モードが使用されます。

* 最大3枚の参照画像。1枚目は編集対象の画像で、残りは被写体、商品、またはスタイルの参照を提供するために使用されます
* 画像1枚あたり最大10MB
* jpeg、png、webp に対応
* 以下の2つの形式に対応：
  1. パブリックアクセス可能な URL
  2. 完全な Base64 Data URI（例：`data:image/jpeg;base64,/9j/4AAQ...`）

> [!WARNING]
>
> URL はインターネットから直接アクセス可能である必要があり、ログイン、Cookie、または一時的なページ認証を要求することはできません。

**aspect\_ratio** `string` (default: 1:1)

画像のアスペクト比。

以下の値に対応しています：

* `1:1` - 正方形（デフォルト）
* `5:4` / `4:5` - 横長（小） / 縦長（小）
* `4:3` / `3:4` - 標準横長 / 縦長
* `16:9` / `9:16` - ワイド横長 / 縦長

> [!WARNING]
>
> `aspect_ratio` はモデルの目標アスペクト比の段階を示し、固定のピクセルサイズを保証するものではありません。その比率に近いモデルのネイティブ解像度が返されます。

**resolution** `string` (default: 1K)

画像の解像度グレード。

* `1K` - 基本解像度（デフォルト）
* `2K` - 高解像度

**output\_n** `string` (default: 1)

生成枚数。

以下の値に対応しています：

* `"1"` - 1枚生成（デフォルト）
* `"2"` - 2枚生成
* `"4"` - 4枚生成

**out\_task\_id** `string` *required*

呼び出し元が定義するカスタムタスク ID。べき等な送信および結果の照会に使用されます。

* 長さは1〜64文字
* 半角英数字、アンダースコア、ハイフンのみ使用可能
* 同じ API Key 内で重複して使用することはできません

## Response

**out\_task\_id** `string`

呼び出し元のタスクID。結果の照会に使用できます。

**status** `string`

初期ステータス。固定値は `"pending"`。

**created\_at** `string`

作成日時。ISO 8601形式。

## 查询结果

送信成功後、同じ `out_task_id` を使用して呼び出します：

```bash theme={null}
curl --request POST \
  --url https://aireiter.com/api/openapi/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "out_task_id": "flux_3_klein_task_001"
  }'
```

タスクステータスには `pending`、`processing`、`completed`、`failed` が含まれます。タスク完了後、生成結果の画像は `data.output` に格納され、複数枚生成された場合は複数の画像 URL からなる配列になります。

```bash cURL（テキストから画像） theme={null}
curl --request POST \
  --url https://aireiter.com/api/openapi/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flux_3_klein",
    "params": {
      "prompt": "現代的なガラス建築の前に停車する未来的なEVスポーツカー、ブルーアワー、濡れた路面に反射する建築の灯り、商業用自動車写真、リアルな質感と自然な陰影、文字なし、ウォーターマークなし",
      "aspect_ratio": "16:9",
      "resolution": "2K",
      "output_n": "2"
    },
    "out_task_id": "flux_3_klein_task_001"
  }'
```

```bash cURL（画像から画像） theme={null}
curl --request POST \
  --url https://aireiter.com/api/openapi/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flux_3_klein",
    "params": {
      "prompt": "1枚目の参考画像の製品ボトルのボディを高級感のある夜間広告スタイルに変更し、ボトルの形状、プロポーション、ノズル、透明ガラス構造、ラベルの文字を維持。製品の外観は2枚目の画像を参照し、背景と照明は3枚目の画像を参照",
      "image_url": [
        "https://example.com/product-original.png",
        "https://example.com/product-texture.png",
        "https://example.com/style-reference.png"
      ],
      "aspect_ratio": "16:9",
      "resolution": "1K",
      "output_n": "2"
    },
    "out_task_id": "flux_3_klein_image_task_001"
  }'
```

```python Python theme={null}
import requests

url = "https://aireiter.com/api/openapi/submit"

payload = {
    "model": "flux_3_klein",
    "params": {
        "prompt": "映画のような製品広告写真、黒い石の台に置かれたガラスの香水瓶、リアルな反射と自然な陰影",
        "aspect_ratio": "16:9",
        "resolution": "1K",
        "output_n": "1"
    },
    "out_task_id": "flux_3_klein_python_001"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch("https://aireiter.com/api/openapi/submit", {
  method: "POST",
  headers: {
    Authorization: "Bearer <token>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "flux_3_klein",
    params: {
      prompt: "映画のような製品広告写真、黒い石の台に置かれたガラスの香水瓶、リアルな反射と自然な陰影",
      aspect_ratio: "16:9",
      resolution: "1K",
      output_n: "1"
    },
    out_task_id: "flux_3_klein_javascript_001"
  })
});

console.log(await response.json());
```

```go Go theme={null}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    payload := []byte(`{
      "model":"flux_3_klein",
      "params":{
        "prompt":"映画のような製品広告写真、黒い石の台に置かれたガラスの香水瓶、リアルな反射と自然な陰影",
        "aspect_ratio":"16:9",
        "resolution":"1K"
      },
      "out_task_id":"flux_3_klein_go_001"
    }`)

    req, _ := http.NewRequest(
        http.MethodPost,
        "https://aireiter.com/api/openapi/submit",
        bytes.NewBuffer(payload),
    )
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    response, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    body, _ := io.ReadAll(response.Body)
    fmt.Println(string(body))
}
```

```java Java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String payload = """
        {
          "model": "flux_3_klein",
          "params": {
            "prompt": "映画のような製品広告写真、黒い石の台に置かれたガラスの香水瓶、リアルな反射と自然な陰影",
            "aspect_ratio": "16:9",
            "resolution": "1K"
          },
          "out_task_id": "flux_3_klein_java_001"
        }
        """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://aireiter.com/api/openapi/submit"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient().send(
            request,
            HttpResponse.BodyHandlers.ofString()
        );
        System.out.println(response.body());
    }
}
```

```php PHP theme={null}
<?php

$payload = [
    "model" => "flux_3_klein",
    "params" => [
        "prompt" => "映画のような製品広告写真、黒い石の台に置かれたガラスの香水瓶、リアルな反射と自然な陰影",
        "aspect_ratio" => "16:9",
        "resolution" => "1K"
    ],
    "out_task_id" => "flux_3_klein_php_001"
];

$ch = curl_init("https://aireiter.com/api/openapi/submit");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
]);

echo curl_exec($ch);
curl_close($ch);
?>
```

```ruby Ruby theme={null}
require 'net/http'
require 'json'
require 'uri'

url = URI("https://aireiter.com/api/openapi/submit")

payload = {
  model: "flux_3_klein",
  params: {
    prompt: "現代的なガラス建築の前に停車している未来的な電動スポーツカー、ブルーアワー、濡れた路面に反射する建物の光、商業自動車写真、リアルな質感と自然な陰影、文字なし、ウォーターマークなし",
    aspect_ratio: "16:9",
    resolution: "2K"
  },
  out_task_id: "flux_3_klein_task_001"
}

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json

response = http.request(request)
puts response.body
```

```swift Swift theme={null}
import Foundation

let url = URL(string: "https://aireiter.com/api/openapi/submit")!

let payload: [String: Any] = [
    "model": "flux_3_klein",
    "params": [
        "prompt": "現代的なガラス建築の前に停車している未来的な電動スポーツカー、ブルーアワー、濡れた路面に反射する建物の光、商業自動車写真、リアルな質感と自然な陰影、文字なし、ウォーターマークなし",
        "aspect_ratio": "16:9",
        "resolution": "2K"
    ],
    "out_task_id": "flux_3_klein_task_001"
]

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error {
        print("Error: \(error)")
        return
    }

    if let data = data, let responseString = String(data: data, encoding: .utf8) {
        print(responseString)
    }
}

task.resume()
```

```csharp C# theme={null}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var url = "https://aireiter.com/api/openapi/submit";

        var payload = @"
              {
                  ""model"": ""flux_3_klein"",
                  ""params"": {
                      ""prompt"": ""現代的なガラス建築の前に停車している未来的な電動スポーツカー、ブルーアワー、濡れた路面に反射する建物の光、商業自動車写真、リアルな質感と自然な陰影、文字なし、ウォーターマークなし"",
                      ""aspect_ratio"": ""16:9"",
                      ""resolution"": ""2K""
                  },
                  ""out_task_id"": ""flux_3_klein_task_001""
              }";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

        var content = new StringContent(payload, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(url, content);
        var result = await response.Content.ReadAsStringAsync();

        Console.WriteLine(result);
    }
}
```

```c C theme={null}
#include <stdio.h>
#include <curl/curl.h>

int main(void) {
    CURL *curl;
    CURLcode res;

    curl_global_init(CURL_GLOBAL_DEFAULT);
    curl = curl_easy_init();

    if(curl) {
        const char *url = "https://aireiter.com/api/openapi/submit";
        const char *payload = "{\"model\":\"flux_3_klein\",\"params\":{\"prompt\":\"現代的なガラス建築の前に停車している未来的な電動スポーツカー、ブルーアワー、濡れた路面に反射する建物の光、商業自動車写真、リアルな質感と自然な陰影、文字なし、ウォーターマークなし\",\"aspect_ratio\":\"16:9\",\"resolution\":\"2K\"},\"out_task_id\":\"flux_3_klein_task_001\"}";

        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Authorization: Bearer <token>");
        headers = curl_slist_append(headers, "Content-Type: application/json");

        curl_easy_setopt(curl, CURLOPT_URL, url);
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

        res = curl_easy_perform(curl);

        if(res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n",
                    curl_easy_strerror(res));
        }

        curl_slist_free_all(headers);
        curl_easy_cleanup(curl);
    }

    curl_global_cleanup();
    return 0;
}
```

```objectivec Objective-C theme={null}
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSURL *url = [NSURL URLWithString:@"https://aireiter.com/api/openapi/submit"];

        NSDictionary *payload = @{
            @"model": @"flux_3_klein",
            @"params": @{
                @"prompt": @"現代的なガラス建築の前に停車している未来的な電動スポーツカー、ブルーアワー、濡れた路面に反射する建物の光、商業自動車写真、リアルな質感と自然な陰影、文字なし、ウォーターマークなし",
                @"aspect_ratio": @"16:9",
                @"resolution": @"2K"
            },
            @"out_task_id": @"flux_3_klein_task_001"
        };

        NSError *error;
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload
                                                          options:0
                                                            error:&error];

        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
        [request setHTTPMethod:@"POST"];
        [request setValue:@"Bearer <token>" forHTTPHeaderField:@"Authorization"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        [request setHTTPBody:jsonData];

        NSURLSessionDataTask *task = [[NSURLSession sharedSession]
            dataTaskWithRequest:request
            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                if (error) {
                    NSLog(@"Error: %@", error);
                    return;
                }
                NSString *result = [[NSString alloc] initWithData:data
                                                        encoding:NSUTF8StringEncoding];
                NSLog(@"%@", result);
            }];

        [task resume];
        [[NSRunLoop mainRunLoop] run];
    }
    return 0;
}
```

```ocaml OCaml theme={null}
(* Requires cohttp and yojson libraries *)
open Lwt
open Cohttp
open Cohttp_lwt_unix

let url = "https://aireiter.com/api/openapi/submit"

let payload = {|{
  "model": "flux_3_klein",
  "params": {
    "prompt": "モダンなガラス建築の前に停車する未来的な電動スポーツカー、ブルーアワー、濡れた地面に反射する建物の灯り、商業用自動車写真、リアルな質感と自然な影、文字なし、ウォーターマークなし",
    "aspect_ratio": "16:9",
    "resolution": "2K"
  },
  "out_task_id": "flux_3_klein_task_001"
}|}

let () =
  let headers = Header.init ()
    |> fun h -> Header.add h "Authorization" "Bearer <token>"
    |> fun h -> Header.add h "Content-Type" "application/json"
  in
  let body = Cohttp_lwt.Body.of_string payload in

  let response = Client.post ~headers ~body (Uri.of_string url) >>= fun (resp, body) ->
    body |> Cohttp_lwt.Body.to_string >|= fun body_str ->
    print_endline body_str
  in
  Lwt_main.run response
```

```dart Dart theme={null}
import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
  final url = Uri.parse('https://aireiter.com/api/openapi/submit');

  final payload = {
        "model": "flux_3_klein",
        "params": {
            "prompt": "モダンなガラス建築の前に停車する未来的な電動スポーツカー、ブルーアワー、濡れた地面に反射する建物の灯り、商業用自動車写真、リアルな質感と自然な影、文字なし、ウォーターマークなし",
            "aspect_ratio": "16:9",
            "resolution": "2K"
        },
        "out_task_id": "flux_3_klein_task_001"
    };

  final response = await http.post(
    url,
    headers: {
      'Authorization': 'Bearer <token>',
      'Content-Type': 'application/json'
    },
    body: jsonEncode(payload),
  );

  print(response.body);
}
```

```r R theme={null}
library(httr)
library(jsonlite)

url <- "https://aireiter.com/api/openapi/submit"

payload <- list(
  model = "flux_3_klein",
  params = list(
    prompt = "モダンなガラス建築の前に停車する未来的な電動スポーツカー、ブルーアワー、濡れた地面に反射する建物の灯り、商業用自動車写真、リアルな質感と自然な影、文字なし、ウォーターマークなし",
    aspect_ratio = "16:9",
    resolution = "2K"
  ),
  out_task_id = "flux_3_klein_task_001"
)

response <- POST(
  url,
  add_headers(
    Authorization = "Bearer <token>",
    `Content-Type` = "application/json"
  ),
  body = toJSON(payload, auto_unbox = TRUE),
  encode = "raw"
)

cat(content(response, "text"))
```

```json 200 theme={null}
{
  "statusCode": 200,
  "message": "",
  "data": {
    "task_id": "",
    "status": "pending",
    "created_at": "2026-07-22T10:37:44.800Z",
    "out_task_id": "flux_3_klein_task_001"
  },
  "ok": true
}
```

```json 400 theme={null}
{
  "statusCode": 400,
  "message": "Invalid aspect_ratio: \"widescreen\". Allowed: [1:1, 5:4, 4:5, 4:3, 3:4, 16:9, 9:16]",
  "ok": false
}
```

```json 401 theme={null}
{
  "error": {
    "code": 401,
    "message": "認証に失敗しました。APIキーを確認してください"
  }
}
```

```json 500 theme={null}
{
  "error": {
    "code": 500,
    "message": "サーバー内部エラーが発生しました。しばらくしてからもう一度お試しください"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.