# IC-Light V2 > Relight an existing photo to a described lighting setup — change light direction, mood, and background while keeping the subject intact. ## Overview - **Endpoint**: `https://queue.modelrunner.run/lllyasviel/iclight/v2` - **Model ID**: `lllyasviel/iclight/v2` - **Category**: image-to-image - **Kind**: inference - **Tags**: relight, relighting, ic-light, iclight, lighting, background-replacement, image-to-image, product-photography ## Pricing - **Price**: $0.1 per megapixel ## Request Lifecycle This model runs on the ModelRunner **asynchronous queue API** — a single POST does not return the output. Every call requires an `Authorization: Key $MODEL_RUNNER_KEY` header. Run three steps: 1. **Submit** — `POST https://queue.modelrunner.run/lllyasviel/iclight/v2` with a JSON body holding the input fields at the top level. The body may also include a reserved top-level `metadata` object — a flat string map (max 16 keys, key ≤64 / value ≤512 chars) stored on the request for your own tagging. It is never sent to the model; filter your request history with `GET https://queue.modelrunner.run/requests?metadata=` (exact key=value matches, AND-ed). The response carries request handles only (no output yet): ```json { "status": "IN_QUEUE", "request_id": "<21-char id>", "status_url": "https://queue.modelrunner.run/lllyasviel/iclight/v2/requests//status", "response_url": "https://queue.modelrunner.run/lllyasviel/iclight/v2/requests/", "cancel_url": "https://queue.modelrunner.run/lllyasviel/iclight/v2/requests//cancel" } ``` 2. **Poll status** — `GET ` until `status` is `COMPLETED`. Possible values are `IN_QUEUE`, `IN_PROGRESS`, `COMPLETED`, `FAILED`, `CANCELLED`. A `FAILED` request responds with HTTP 400 and an `error` field. 3. **Read result** — `GET `. Returns the finished request, including the generated `output`: ```json { "id": "", "status": "COMPLETED", "output": ..., "input": ... } ``` The JavaScript and Python SDKs below perform steps 2–3 for you. In any language without an SDK (Swift, Go, Kotlin, etc.) you must implement the polling loop and the final result fetch yourself — see the cURL example for the full flow. ### Input Schema - **`cfg`** (`number`, _optional_): Real classifier-free-guidance scale. Lower values stay more faithful to the input image. - Default: `1` - Range: `0.01` to `5` - **`seed`** (`integer | null`, _optional_): Random seed. The same seed, prompt, and image produce the same result. - **`prompt`** (`string`, _required_): Describe the lighting you want — direction, color, mood — and the surrounding scene to relight the subject into (e.g. 'warm sunset light from the left, golden-hour window behind'). - **`image_url`** (`string`, _required_): The source photo to relight. The subject is preserved while its lighting is re-rendered. - **`image_size`** (`ImageSize | ImageSizeEnum`, _optional_): Output dimensions. Leave unset to keep the input image's dimensions (recommended for compositing). Pass a preset string (e.g. 'landscape_4_3') or a custom {width, height} object to re-frame the result. - Options: `"square_hd"`, `"square"`, `"portrait_4_3"`, `"portrait_16_9"`, `"landscape_4_3"`, `"landscape_16_9"` - **`hr_downscale`** (`number`, _optional_): Downscale factor for the high-res fix pass; only used when enable_hr_fix is true. - Default: `0.5` - Range: `0.01` to `1` - **`enable_hr_fix`** (`boolean`, _optional_): Run a high-resolution refinement pass for sharper detail (slower). - Default: `false` - **`guidance_scale`** (`number`, _optional_): Prompt adherence strength. Higher values follow the lighting description more strongly. - Default: `5` - Range: `0` to `20` - **`initial_latent`** (`InitialLatentEnum`, _optional_): Bias the dominant light direction. 'None' lets the prompt decide; 'Left', 'Right', 'Top', or 'Bottom' push the key light to that side. - Default: `"None"` - Options: `"None"`, `"Left"`, `"Right"`, `"Top"`, `"Bottom"` - **`lowres_denoise`** (`number`, _optional_): Denoise strength for the initial low-resolution pass. - Default: `0.98` - Range: `0.01` to `1` - **`mask_image_url`** (`string | null`, _optional_): Optional binary mask marking the subject to keep. When omitted, the subject is isolated automatically by background removal. - **`highres_denoise`** (`number`, _optional_): Denoise strength for the high-res fix pass; only used when enable_hr_fix is true. - Default: `0.95` - Range: `0.01` to `1` - **`negative_prompt`** (`string`, _optional_): Describe what you do not want in the relit result. - Default: `""` - **`num_inference_steps`** (`integer`, _optional_): Number of denoising steps. More steps can improve detail at the cost of speed. - Default: `28` - Range: `1` to `50` - **`enable_safety_checker`** (`boolean`, _optional_): If set to true, the safety checker will be enabled. - Default: `true` ### Output Schema _No `Output` schema properties are available._ ## Default Example **Input** ```json { "cfg": 1, "prompt": "dramatic warm sunset light from the left, soft golden glow on the subject, cozy indoor ambience", "image_url": "https://media.modelrunner.ai/MvSAQVWwUHJspDow-1024", "hr_downscale": 0.5, "enable_hr_fix": false, "guidance_scale": 5, "initial_latent": "Left", "lowres_denoise": 0.98, "highres_denoise": 0.95, "negative_prompt": "", "num_inference_steps": 20, "enable_safety_checker": true } ``` **Output** ```json [ "https://media.modelrunner.ai/ZGgfdjXILhlzQeuIkzcay.png" ] ``` ## Usage Examples ### cURL The queue API is asynchronous: submit the request, poll `status_url` until it is `COMPLETED`, then read the result from `response_url`. Requires `jq`. ```bash # 1. Submit the request (returns request handles, not the output) SUBMIT=$(curl --silent --request POST \ --url https://queue.modelrunner.run/lllyasviel/iclight/v2 \ --header "Authorization: Key $MODEL_RUNNER_KEY" \ --header "Content-Type: application/json" \ --data '{ "cfg": 1, "prompt": "dramatic warm sunset light from the left, soft golden glow on the subject, cozy indoor ambience", "image_url": "https://media.modelrunner.ai/MvSAQVWwUHJspDow-1024", "hr_downscale": 0.5, "enable_hr_fix": false, "guidance_scale": 5, "initial_latent": "Left", "lowres_denoise": 0.98, "highres_denoise": 0.95, "negative_prompt": "", "num_inference_steps": 20, "enable_safety_checker": true }') STATUS_URL=$(echo "$SUBMIT" | jq -r '.status_url') RESPONSE_URL=$(echo "$SUBMIT" | jq -r '.response_url') # 2. Poll until the request leaves the queue / in-progress state while true; do STATUS=$(curl --silent --url "$STATUS_URL" \ --header "Authorization: Key $MODEL_RUNNER_KEY" | jq -r '.status') echo "Status: $STATUS" case "$STATUS" in COMPLETED) break ;; FAILED|CANCELLED) echo "Request $STATUS"; exit 1 ;; esac sleep 1 done # 3. Read the finished request, including the generated output curl --silent --url "$RESPONSE_URL" \ --header "Authorization: Key $MODEL_RUNNER_KEY" ``` ### JavaScript ```javascript import { modelrunner } from "@modelrunner/client"; const result = await modelrunner.subscribe("lllyasviel/iclight/v2", { input: { "cfg": 1, "prompt": "dramatic warm sunset light from the left, soft golden glow on the subject, cozy indoor ambience", "image_url": "https://media.modelrunner.ai/MvSAQVWwUHJspDow-1024", "hr_downscale": 0.5, "enable_hr_fix": false, "guidance_scale": 5, "initial_latent": "Left", "lowres_denoise": 0.98, "highres_denoise": 0.95, "negative_prompt": "", "num_inference_steps": 20, "enable_safety_checker": true } }); console.log(result.data); ``` ### Python ```python import asyncio import modelrunner_ai async def main(): response = await modelrunner_ai.submit_async( "lllyasviel/iclight/v2", arguments={ "cfg": 1, "prompt": "dramatic warm sunset light from the left, soft golden glow on the subject, cozy indoor ambience", "image_url": "https://media.modelrunner.ai/MvSAQVWwUHJspDow-1024", "hr_downscale": 0.5, "enable_hr_fix": false, "guidance_scale": 5, "initial_latent": "Left", "lowres_denoise": 0.98, "highres_denoise": 0.95, "negative_prompt": "", "num_inference_steps": 20, "enable_safety_checker": true } ) result = await response.get() print(result["output"]) asyncio.run(main()) ``` ## Additional Resources - [Playground](https://modelrunner.ai/models/lllyasviel/iclight/v2) - [OpenAPI Schema](https://modelrunner.ai/models/lllyasviel/iclight/v2/openapi.json) - [LLM Instructions](https://modelrunner.ai/models/lllyasviel/iclight/v2/llms.txt)