{"openapi":"3.0.2","info":{"title":"stability/edit-replace-background-and-relight","description":"The request body Comfy Router accepts for the model \"stability/edit-replace-background-and-relight\", and the response body it returns. The INPUT schema is the same schema the server validates a call against before it reaches the provider, so what is published and what is enforced cannot differ. `x-comfy-router-input-modalities` records the media kinds the model is documented to accept; the request schema is shared across sibling models and may admit media kinds this model ignores. The OUTPUT schema describes the provider's native result document exactly as Router returns it: Router does not validate, narrow or re-envelope the response, so the output schema is descriptive rather than enforced, and Comfy owns no output shape of its own.","version":"2e5ee963552b"},"paths":{"/v2/models/stability/edit-replace-background-and-relight":{"post":{"operationId":"runRouterModel","summary":"Run stability/edit-replace-background-and-relight synchronously.","security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"description":"Comfy Router request for Stability replace-background-and-relight, in Stability's edit fields sent as a JSON object. Keeps the subject of `subject_image`, replaces its background from `background_prompt` or `background_reference`, and relights it. One of `background_prompt` or `background_reference` is required, and `light_source_strength` needs `light_reference` or `light_source_direction`; both rules are enforced by the translator, not by this schema. Each image must be at least 64 pixels a side and at most 9,437,184 pixels in all; that is checked when the image is staged. Router submits the job and polls it to the end (`/proxy/stability/edit-replace-background-and-relight` answers `{\"id\"}`, and `GET .../jobs/{id}` answers 202 until it is done). Returns one PNG and is billed once, when the job succeeds.","example":{"background_prompt":"a sunlit beach at golden hour","light_source_direction":"above","light_source_strength":0.5,"seed":12345,"subject_image":"https://storage.googleapis.com/example-bucket/subject.png"},"properties":{"background_prompt":{"description":"The new background. Required when `background_reference` is omitted.","maxLength":10000,"type":"string"},"background_reference":{"description":"A Comfy-signed asset URL of an image the new background follows.","format":"uri","type":"string"},"foreground_prompt":{"description":"What the subject is.","maxLength":10000,"type":"string"},"keep_original_background":{"description":"`true` keeps elements of the original background. Default `false`. A string, as in Stability's form fields.","enum":["true","false"],"type":"string"},"light_reference":{"description":"A Comfy-signed asset URL of an image the lighting follows.","format":"uri","type":"string"},"light_source_direction":{"description":"Where the light comes from. `left` is not offered.","enum":["right","below","above"],"type":"string"},"light_source_strength":{"description":"How strong the light is. Needs `light_reference` or `light_source_direction`.","maximum":1,"minimum":0,"type":"number"},"negative_prompt":{"description":"What to keep out of the image.","maxLength":10000,"type":"string"},"original_background_depth":{"description":"How closely the new background matches the subject's depth. Default 0.5.","maximum":1,"minimum":0,"type":"number"},"output_format":{"description":"Omitted is `png`. `jpeg` and `webp` are served only while the deployment's stability output-format switch is on; otherwise they are refused with a 400 before any job runs. The format never changes the price.","enum":["png","jpeg","webp"],"type":"string"},"preserve_original_subject":{"description":"How exactly to keep the original subject. Default 0.6.","maximum":1,"minimum":0,"type":"number"},"seed":{"description":"0 or omitted picks a random seed.","maximum":4294967294,"minimum":0,"type":"integer"},"subject_image":{"description":"A Comfy-signed asset URL of the image whose subject is kept.","format":"uri","type":"string"}},"required":["subject_image"],"type":"object"}}}},"responses":{"200":{"description":"OK - the model's native JSON output, returned unchanged; the schema describes the provider's terminal result document as Router returns it.","content":{"application/json":{"schema":{"description":"Comfy Router output schema for the Stability image models. The image is generated on Comfy-hosted infrastructure and stored on Comfy storage: `image` is a Comfy-signed URL valid for up to 24 hours, not a Stability URL, so download it before then. If the image cannot be stored, the call answers 502 and is not billed; no other URL is returned.","example":{"finish_reason":"SUCCESS","image":"https://example.invalid/stability/image.png","seed":12345},"properties":{"finish_reason":{"description":"Always SUCCESS on a 200.","type":"string"},"image":{"description":"Comfy-signed URL of the (first) PNG image, valid for up to 24 hours.","format":"uri","type":"string"},"images":{"description":"SDXL only, when more than one image was returned. Every Comfy-signed image URL, in output order, each valid for up to 24 hours.","items":{"format":"uri","type":"string"},"type":"array"},"seed":{"description":"The seed the image was generated with.","type":"integer"}},"required":["image","finish_reason","seed"],"type":"object"}}}}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"x-comfy-router-model-id":"stability/edit-replace-background-and-relight","x-comfy-input-schema-authored":true,"x-comfy-output-schema-authored":true,"x-comfy-router-input-modalities":["text","image"],"x-comfy-router-output-modalities":["image"]}
