# Image Relighting API Documentation > LLM-optimized documentation for Image Relighting. Copy into your AI assistant for integration help. ## Overview **Model ID:** `image-relighting` **Type:** Image Generation **Credit Cost:** 1 credits per image Relight images with Magic Lighting, Nano Banana Pro/2, or Qwen Image Edit — multi-provider routing with per-model credit rates. ## Endpoint ``` POST https://pixeldojo.ai/api/v1/models/image-relighting/run ``` ## Authentication All requests require an API key in the Authorization header: ``` Authorization: Bearer YOUR_API_KEY ``` Get your API key: https://pixeldojo.ai/api-platform/api-keys ## Input Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `subject_image` | url | Yes | - | URL of the image to relight. | | `prompt` | string | No | - | Describe the desired lighting (e.g. "cinematic neon lighting", "golden hour"). | | `light_source` | string | No | - | Optional direction / type of the light source. | | `model_type` | enum | No | magic-lighting | Which underlying relighting model to use. (Options: magic-lighting, nano-banana-pro, nano-banana-2, qwen-image-edit) | | `number_of_images` | integer | No | 1 | How many variations to generate (1-12). (min: 1, max: 12) | | `aspectRatio` | enum | No | 1:1 | Output aspect ratio. (Options: 1:1, 16:9, 9:16, 4:3, 3:4...) | | `negative_prompt` | string | No | - | What to avoid in the output. | | `appended_prompt` | string | No | best quality | Quality keywords appended to every prompt (Magic Lighting only). | | `output_format` | enum | No | png | Image encoding format. (Options: png, jpg, webp) | | `width` | string | No | 1024 | Output width in pixels (Magic Lighting only). | | `height` | string | No | 1024 | Output height in pixels (Magic Lighting only). | | `steps` | integer | No | 25 | Diffusion steps (Magic Lighting only; higher = slower + sharper). (min: 10, max: 50) | | `cfg` | number | No | 2 | Prompt adherence (Magic Lighting only). | | `highres_scale` | number | No | 1.5 | Upscale factor for the highres pass (Magic Lighting only). | | `highres_denoise` | number | No | 0.5 | Denoise strength for the highres pass (Magic Lighting only). | | `lowres_denoise` | number | No | 0.9 | Denoise strength for the initial pass (Magic Lighting only). | | `output_quality` | integer | No | 100 | Image quality 1-100. (min: 1, max: 100) | | `seed` | integer | No | - | Random seed for reproducibility. | ## Capabilities - Image to Image ## Quick Start ### 1. Submit a Job ```bash curl -X POST "https://pixeldojo.ai/api/v1/models/image-relighting/run" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A beautiful mountain landscape at golden hour, photorealistic", "aspect_ratio": "1:1" }' ``` **Response:** ```json { "jobId": "job_abc123...", "status": "pending", "statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123", "creditCost": 1, "creditsRemaining": 95 } ``` ### 2. Poll for Results ```bash curl "https://pixeldojo.ai/api/v1/jobs/job_abc123" \ -H "Authorization: Bearer YOUR_API_KEY" ``` **Completed Response:** ```json { "jobId": "job_abc123...", "status": "completed", "output": { "images": ["https://temp.pixeldojo.ai/..."] }, "creditCost": 1 } ``` ## Python Example ```python import requests import time API_KEY = "YOUR_API_KEY" # Submit job response = requests.post( "https://pixeldojo.ai/api/v1/models/image-relighting/run", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, json={ "prompt": "A beautiful mountain landscape at golden hour, photorealistic", "aspect_ratio": "1:1" } ) job = response.json() job_id = job["jobId"] # Poll for completion while True: status_response = requests.get( f"https://pixeldojo.ai/api/v1/jobs/{'{job_id}'}", headers={"Authorization": f"Bearer {API_KEY}"} ) status = status_response.json() if status["status"] == "completed": print("Output:", status["output"]) break elif status["status"] == "failed": print("Error:", status.get("error")) break time.sleep(2) ``` ## JavaScript Example ```javascript const API_KEY = 'YOUR_API_KEY'; // Submit job const submitResponse = await fetch('https://pixeldojo.ai/api/v1/models/image-relighting/run', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: 'A beautiful mountain landscape at golden hour, photorealistic', aspect_ratio: '1:1' }) }); const job = await submitResponse.json(); // Poll for completion const pollForResult = async (jobId) => { while (true) { const statusResponse = await fetch(`https://pixeldojo.ai/api/v1/jobs/${jobId}`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); const status = await statusResponse.json(); if (status.status === 'completed') return status.output; if (status.status === 'failed') throw new Error(status.error); await new Promise(r => setTimeout(r, 2000)); } }; const output = await pollForResult(job.jobId); console.log('Output:', output); ``` ## Error Codes | Code | Status | Description | |------|--------|-------------| | `unauthorized` | 401 | Invalid or missing API key | | `insufficient_credits` | 402 | Not enough credits | | `invalid_request` | 400 | Invalid parameters | | `model_not_found` | 404 | Model ID not found | | `rate_limited` | 429 | Too many requests | | `internal_error` | 500 | Server error | ## Links - **Full Documentation:** https://pixeldojo.ai/api-platform/image-relighting - **API Keys:** https://pixeldojo.ai/api-platform/api-keys - **Buy Credits:** https://pixeldojo.ai/api-platform/buy-credits - **All Models:** https://pixeldojo.ai/api/v1/models - **OpenAPI Spec:** https://pixeldojo.ai/api/openapi