Skip to main content
POST
Generate an image from a text prompt
오른쪽의 대화형 Playground는 실시간 디버깅을 지원합니다. Authorization 헤더에 API Key를 입력하고(형식: Bearer sk-xxx), 모델과 크기를 선택한 다음 prompt를 입력하여 전송합니다.
이 페이지는 다음 용도로 사용합니다: “text generates image” — prompt만 있으면 되며 업로드는 필요하지 않습니다. 기존 이미지를 편집하거나 여러 참조 이미지를 융합하려면 Image Editing endpoint를 참조하십시오.
⚠️ 주요 차이점 / 지원되지 않는 매개변수
  • 결과 URL은 10분 동안만 유효합니다data[0].url는 즉시 다운로드해야 하며, 만료된 URL은 404를 반환합니다
  • width / height는 16의 배수여야 합니다 — 그렇지 않으면 400을 반환합니다
  • prompt_upsampling는 FLUX.2 [klein]에서 지원되지 않습니다 — 무시되어도 별도로 알림이 표시되지 않습니다
  • 총 픽셀 한도는 4MP(~2048×2048) — 초과하면 400을 반환합니다
  • grounding searchflux-2-max에서만 지원됩니다 — 다른 모델은 시의성이 중요한 prompt라도 실시간 검색을 트리거하지 않습니다
모든 image API는 동기식입니다 — 폴링할 task ID가 없으며, 클라이언트가 연결을 끊으면 요청이 아직 과금되는 동안 결과는 사라집니다. 이 모델에는 충분히 넉넉한 timeout을 설정하십시오. 자세한 내용은 Image API Essentials & Best Practices를 참조하십시오.

코드 예제

Python (OpenAI SDK 드롭인)

Python (네이티브 requests · width/height 문법 포함)

cURL

Node.js (네이티브 fetch)

Browser JavaScript (직접 렌더링)

매개변수 참조

지원되는 모델 ID

세부 제약, 허용 값, 예시는 오른쪽 Playground 필드 힌트에서 확인할 수 있습니다. 모든 enum 필드는 드롭다운 선택을 지원합니다.

응답 형식

⚠️ data[0].url의 유효 시간은 10분입니다
  • URL은 delivery-eu.bfl.ai / delivery-us.bfl.ai에 호스팅되며, 서명은 10분 후 만료됩니다
  • CORS는 비활성화되어 있습니다 — 브라우저 fetch는 차단되지만, <img src> 렌더링은 작동합니다
  • 운영 서비스는 반드시 서버 측에서 자체 OSS / CDN으로 다운로드해야 합니다
  • OpenAI의 gpt-image-2b64_json를 반환하는 것과 달리, FLUX는 URL만 반환합니다 — base64는 없습니다.
FLUX는 usage 필드를 반환하지 않습니다(이미지당 과금되며, token당은 아닙니다). 실제 과금은 이 사이트의 요금표를 따릅니다. 응답 헤더 x-request-id는 지원 추적용입니다.

인증

Authorization
string
header
필수

API Key from the APIYI Console

본문

application/json
model
enum<string>
기본값:flux-2-pro
필수

FLUX model ID. For FLUX.2 prefer flux-2-pro / flux-2-max; legacy versions in the Historical Versions page.

사용 가능한 옵션:
flux-2-max,
flux-2-pro,
flux-2-flex,
flux-2-klein-9b,
flux-2-klein-4b,
flux-pro-1.1-ultra,
flux-pro-1.1,
flux-pro,
flux-dev
prompt
string
필수

Prompt, up to 32K tokens. Supports natural language, hex codes, and structured JSON.

예시:

"A cinematic shot of a futuristic city at sunset, 85mm lens"

size
string
기본값:1024x1024

OpenAI-style size string. Pick either size or width+height. Common: 1024x1024 / 1536x1024 / 1024x1536 / 1920x1080 / 1440x2048 / 2048x2048. Custom must satisfy: multiples of 16, 64×64–4MP.

예시:

"1920x1080"

width
integer
기본값:1024

BFL-native syntax, alternative to size. Must be a multiple of 16, between 64 and 2048.

필수 범위: 64 <= x <= 2048
예시:

1920

height
integer
기본값:1024

BFL-native syntax. Must be a multiple of 16, between 64 and 2048.

필수 범위: 64 <= x <= 2048
예시:

1080

seed
integer

Fix for reproducibility — same seed + same other params yields the same result.

예시:

42

safety_tolerance
integer
기본값:2

Moderation level. 0 = strictest, 6 = most permissive, default 2.

필수 범위: 0 <= x <= 6
output_format
enum<string>
기본값:jpeg

Output format.

사용 가능한 옵션:
jpeg,
png
prompt_upsampling
boolean
기본값:false

Auto-expand the prompt. Not supported on FLUX.2 [klein] (silently ignored).

steps
integer
기본값:50

Only flux-2-flex. Inference steps, max 50.

필수 범위: 1 <= x <= 50
guidance
number
기본값:4.5

Only flux-2-flex. Guidance scale. 1.5–10, higher = closer to prompt.

필수 범위: 1.5 <= x <= 10
n
enum<integer>
기본값:1

Number of images. Only 1 supported.

사용 가능한 옵션:
1

응답

Image generated

created
integer

Unix timestamp

예시:

1776832476

data
object[]

Result array (single image per call)