FLUX.2 [klein] 9B Image-to-Image API
/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/image-to-image |
|---|---|
| Type | Image generation (image-to-image) |
| Endpoint | POST /v1/tasks |
| Pricing | See HiAPI Pricing |
FLUX.2 [klein] 9B image-to-image API for fast four-step single-reference editing with stronger detail preservation, text rendering, and commercial finish.
Production guidance
- For production, pass callback.url at the top level of the request body so HiAPI can notify your service when the task reaches a terminal state.
- GET /v1/tasks/:id is better for local debugging, low-volume jobs, or fallback reconciliation if a callback is missed.
- Use callback.when=final. Both success and fail are terminal states, so your service should deduplicate by taskId.
Best suited for
Prioritizes material detail, lighting, and preservation for hero advertising images.
image_urlspromptThe 9B route is a better fit when in-image text, marks, and complex local detail need stronger rendering.
promptDefaults to four inference steps for a practical speed-quality balance.
num_inference_stepsSupports 1:1, 4:3, 3:4, 16:9, and 9:16 for product cards, banners, and vertical ads.
aspect_ratioRequest parameters
model string required Fixed value flux-2-klein-9b/image-to-image.
input object required Business parameters. Put FLUX.2 [klein] 9B Image to Image-specific configuration here.
prompt string required Describe the edits to apply to the reference image.
image_urls string[] required One reference image. Supports jpeg, png, or webp; svg is not supported. Input images are processed at about 1 MP.
aspect_ratio enum optional Aspect ratio for the generated image.
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.
output_format enum optional Format of the generated image.
callback object optional Optional callback configuration. When set, HiAPI notifies your service when the task reaches a terminal state.
url string required Required when callback is set; HTTPS URL that receives terminal task notifications.
when enum optional Callback trigger timing. Use final.
Example requests
Uses one public reference image, keeps the subject and angle, and enhances materials, natural lighting, and commercial polish.
{
"model": "flux-2-klein-9b/image-to-image",
"input": {
"prompt": "Keep the subject and camera angle. Refine the image into a premium commercial advertisement with richer material detail and natural lighting.",
"image_urls": [
"https://static.hiapi.ai/gallery/2026/07/f35f947e46888163.png"
],
"aspect_ratio": "16:9",
"seed": 20260727,
"num_inference_steps": 4,
"output_format": "webp"
}
}Getting the result
- The response returns a taskId immediately without waiting for generation to finish.
- In production, prefer waiting for callback.url to receive the terminal notification. For local debugging, poll GET /v1/tasks/:id.
- When status=success, download the generated image from output[].url.
- When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.
FAQ
How many reference images does 9B image-to-image support?
HiAPI currently exposes one reference image. image_urls must be an array containing one public image URL.
How is 9B image-to-image billed?
It is currently billed at a fixed per-output-image price, independent of aspect_ratio, output_format, or inference steps. See the live HiAPI pricing page for current rates. View live pricing
Why does 9B cost more than 4B?
9B targets stronger final-image quality, detail preservation, text rendering, and complex edits. 4B is better for cost-sensitive, high-volume iteration.
What are the input-image limits?
jpeg, png, and webp are supported; svg is not supported. Input images are processed at about 1 MP. Use a stable, publicly accessible HTTPS URL.