Skip to content
English

FLUX.2 [klein] 9B Text-to-Image API

POST /v1/tasks

All models are called through the Unified Async API POST /v1/tasks endpoint; only the input fields differ (see input parameters below).

Model summary

Model name flux-2-klein-9b/text-to-image
Type Image generation (text-to-image)
Endpoint POST /v1/tasks
Pricing See HiAPI Pricing

A fast four-step FLUX.2 text-to-image model that balances speed and image quality for commercial visuals, complex scenes, and posters with English titles.

Production guidance

Production guidance
  • Pass callback.url at the top level so HiAPI can notify your service when the task reaches a terminal state.
  • Use GET /v1/tasks/:id for local debugging or fallback reconciliation.
  • The default four steps suit most requests; review spelling and layout for important typography deliverables.

Best suited for

Posters and covers with text

HiAPI dev tests produced clear English titles for magazine covers, campaign posters, and branded artwork; important text still needs review.

promptaspect_ratio
Realistic commercial visuals

A good fit for product campaigns and editorial photography that depend on lighting, material, and spatial detail.

promptnum_inference_steps
Fast, polished concepts

The default four-step path balances speed and detail for rapid creative selection.

promptnum_inference_steps
Stable composition iteration

Fix the seed while refining titles, color palettes, and environmental details.

promptseed

Request parameters

model string required

Fixed value flux-2-klein-9b/text-to-image.

example flux-2-klein-9b/text-to-image
input object required

Business parameters for FLUX.2 [klein] 9B.

prompt string required

Text prompt for image generation.

aspect_ratio enum optional

Aspect-ratio preset for square, landscape, or portrait output.

default 4:3 enum: 1:14:33:416:99:16
seed integer optional

Random seed for reproducible generation.

num_inference_steps integer optional

Number of inference steps. Must be an integer from 4 to 8; defaults to 4.

default 4
output_format enum optional

File format of the generated image.

default png enum: jpegpngwebp
callback object optional

Optional callback configuration for terminal task notifications.

url string required

Required when callback is set; HTTPS URL that receives terminal task notifications.

example https://your-domain.com/hiapi/callback
when enum optional

Callback trigger timing. Use final.

default final enum: final

Example requests

Lunar hotel editorial poster

A 4:3 poster testing readable typography, moonlit architecture, and editorial art direction.

Request body
{
  "model": "flux-2-klein-9b/text-to-image",
  "input": {
    "prompt": "A premium editorial poster for a fictional lunar hotel, crisp readable title 'LUNAR NOIR', cinematic moonlit architecture",
    "aspect_ratio": "4:3",
    "num_inference_steps": 4,
    "output_format": "png"
  }
}
16:9 greenhouse night market

A wide composition with a complex scene, luminous lanterns, and readable signage.

Request body
{
  "model": "flux-2-klein-9b/text-to-image",
  "input": {
    "prompt": "A cinematic night market built inside a glass greenhouse, luminous paper lanterns, crisp readable sign 'NIGHT BLOOM', premium editorial photography",
    "aspect_ratio": "16:9",
    "seed": 42,
    "num_inference_steps": 4,
    "output_format": "webp"
  }
}

Getting the result

  1. The response returns a taskId immediately without waiting for generation to finish.
  2. In production, prefer callback.url for the terminal notification. For local debugging, poll GET /v1/tasks/:id.
  3. When status=success, download the generated image from output[].url.
  4. When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.

FAQ

What is the FLUX.2 [klein] 9B API?

It is a FLUX.2 text-to-image model that balances generation speed and image quality. HiAPI currently exposes it for rapid concepts, commercial visuals, and posters with English titles.

How is FLUX.2 [klein] 9B priced on HiAPI?

Supported aspect-ratio presets use flat per-image pricing. Use the live pricing page for current rates. View live pricing

Why is FLUX.2 [klein] 9B suitable for fast generation?

The model uses a four-step inference path by default, making it suitable for rapid prototyping and frequent content production. Actual latency still varies with queue, scene complexity, and network conditions.

Is FLUX.2 [klein] 9B suitable for poster typography?

HiAPI dev tests produced readable English titles, but that does not guarantee perfect text in every image. Review spelling and allow retries for important or complex layouts.

Does FLUX.2 [klein] 9B support image editing?

This page exposes text-to-image generation only and does not accept a reference image or image-editing parameters. Use a dedicated image-to-image model to modify an existing image.

Next steps