Advanced Composite Image Creation with Nano Banana Pro
Seamlessly merge multiple images into stunning composites using Nano Banana Pro.
~$0.1647
1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/692166176745e3e4213f5140-v2"
7
8data = {
9 "Input_Prompt": "combine all of these photos with exact facial reference, party night group photo with these characters with similar outfits\nthere should not be any repeated photos",
10 "Input_Image": [
11 "https://segmind-inference-inputs.s3.amazonaws.com/23844143-9aeb-482b-ab13-08b735d89afe-fc5e952c-b07a-4cf0-9797-cd0e1c43c1e9-a9a90fde-9db1-48ad-aec1-8ae136934732.webp",
12 "https://segmind-inference-inputs.s3.amazonaws.com/9a24d78c-0ab2-4c64-9573-308e6052997a-eb2920dc-b339-4982-8646-0be5e957d015.png",
13 "https://segmind-inference-inputs.s3.amazonaws.com/5bddf39b-5697-4b05-990d-a8118ccda276-2c9ca07d-2090-40c6-ba8d-d1fc8138c6d1-4f5f27be-f541-41d2-b494-d8032b68f68f.webp",
14 "https://segmind-inference-inputs.s3.amazonaws.com/28d9dc75-4f23-4740-9aeb-f0b07e501b1b-b1ea1613-d10b-4bab-b3a9-2fcfedc47e09-cf5d6d3d-9be2-4538-b6b2-3d8ff11594b9-Beach-walk.webp",
15 "https://segmind-inference-inputs.s3.amazonaws.com/e3ef9024-bea3-4b19-8e2a-c1452db92381-80871143-ba65-4eab-accd-e780f19c1f14-d475a23c-effb-45f5-a7a7-c16f42bd93c1.webp",
16 "https://segmind-inference-inputs.s3.amazonaws.com/009b37ae-47f2-4bc6-bf60-8ac3c1f35f2a-c4be44be-1e40-42d5-9d26-710ee76dbfb8-STYLE2.webp",
17 "https://segmind-inference-inputs.s3.amazonaws.com/9244c98d-1e05-47e4-98c3-0538256e48d6-b76f2d19-ae43-4ac4-a94e-0ec8106a031c-MODEL.webp",
18 "https://segmind-inference-inputs.s3.amazonaws.com/5e21b288-f207-4457-b124-3bb425b8c42a-a0587d02-9e44-40cc-8946-6d2f392cebd0-31933.webp",
19 "https://segmind-inference-inputs.s3.amazonaws.com/e8b9de29-8f6f-431a-9437-9a49d900642d-b8c87536-a411-4d66-b5f9-0688b7ee2f63-184cd917-6e26-4cfd-9dfd-134683780dfe.webp",
20 "https://segmind-inference-inputs.s3.amazonaws.com/013d19ea-b108-4de8-a453-33b187a3c65b-image (2).png"
21 ]
22}
23
24def poll_for_result(poll_url):
25 """Poll the API until the generation is complete"""
26 while True:
27 response = requests.get(
28 poll_url,
29 headers={'Authorization': f'Bearer {api_key}'}
30 )
31 result = response.json()
32
33 if result['status'] == 'COMPLETED':
34 # Parse the output (it's a JSON string)
35 outputs = json.loads(result['output'])
36 return outputs
37 elif result['status'] == 'FAILED':
38 raise Exception(result.get('error', 'Generation failed'))
39
40 # Wait 7 seconds before polling again
41 time.sleep(7)
42
43# Make the initial request
44response = requests.post(
45 url,
46 json=data,
47 headers={
48 'Authorization': f'Bearer {api_key}',
49 'Content-Type': 'application/json'
50 }
51)
52
53if response.status_code == 200:
54 result = response.json()
55 print('Request queued:', result)
56
57 # Start polling for results
58 outputs = poll_for_result(result['poll_url'])
59 print('Generation complete:', outputs)
60else:
61 print(f"Error: {response.status_code}")
62 print(response.text) 1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/692166176745e3e4213f5140-v2"
7
8data = {
9 "Input_Prompt": "combine all of these photos with exact facial reference, party night group photo with these characters with similar outfits\nthere should not be any repeated photos",
10 "Input_Image": [
11 "https://segmind-inference-inputs.s3.amazonaws.com/23844143-9aeb-482b-ab13-08b735d89afe-fc5e952c-b07a-4cf0-9797-cd0e1c43c1e9-a9a90fde-9db1-48ad-aec1-8ae136934732.webp",
12 "https://segmind-inference-inputs.s3.amazonaws.com/9a24d78c-0ab2-4c64-9573-308e6052997a-eb2920dc-b339-4982-8646-0be5e957d015.png",
13 "https://segmind-inference-inputs.s3.amazonaws.com/5bddf39b-5697-4b05-990d-a8118ccda276-2c9ca07d-2090-40c6-ba8d-d1fc8138c6d1-4f5f27be-f541-41d2-b494-d8032b68f68f.webp",
14 "https://segmind-inference-inputs.s3.amazonaws.com/28d9dc75-4f23-4740-9aeb-f0b07e501b1b-b1ea1613-d10b-4bab-b3a9-2fcfedc47e09-cf5d6d3d-9be2-4538-b6b2-3d8ff11594b9-Beach-walk.webp",
15 "https://segmind-inference-inputs.s3.amazonaws.com/e3ef9024-bea3-4b19-8e2a-c1452db92381-80871143-ba65-4eab-accd-e780f19c1f14-d475a23c-effb-45f5-a7a7-c16f42bd93c1.webp",
16 "https://segmind-inference-inputs.s3.amazonaws.com/009b37ae-47f2-4bc6-bf60-8ac3c1f35f2a-c4be44be-1e40-42d5-9d26-710ee76dbfb8-STYLE2.webp",
17 "https://segmind-inference-inputs.s3.amazonaws.com/9244c98d-1e05-47e4-98c3-0538256e48d6-b76f2d19-ae43-4ac4-a94e-0ec8106a031c-MODEL.webp",
18 "https://segmind-inference-inputs.s3.amazonaws.com/5e21b288-f207-4457-b124-3bb425b8c42a-a0587d02-9e44-40cc-8946-6d2f392cebd0-31933.webp",
19 "https://segmind-inference-inputs.s3.amazonaws.com/e8b9de29-8f6f-431a-9437-9a49d900642d-b8c87536-a411-4d66-b5f9-0688b7ee2f63-184cd917-6e26-4cfd-9dfd-134683780dfe.webp",
20 "https://segmind-inference-inputs.s3.amazonaws.com/013d19ea-b108-4de8-a453-33b187a3c65b-image (2).png"
21 ]
22}
23
24def poll_for_result(poll_url):
25 """Poll the API until the generation is complete"""
26 while True:
27 response = requests.get(
28 poll_url,
29 headers={'Authorization': f'Bearer {api_key}'}
30 )
31 result = response.json()
32
33 if result['status'] == 'COMPLETED':
34 # Parse the output (it's a JSON string)
35 outputs = json.loads(result['output'])
36 return outputs
37 elif result['status'] == 'FAILED':
38 raise Exception(result.get('error', 'Generation failed'))
39
40 # Wait 7 seconds before polling again
41 time.sleep(7)
42
43# Make the initial request
44response = requests.post(
45 url,
46 json=data,
47 headers={
48 'Authorization': f'Bearer {api_key}',
49 'Content-Type': 'application/json'
50 }
51)
52
53if response.status_code == 200:
54 result = response.json()
55 print('Request queued:', result)
56
57 # Start polling for results
58 outputs = poll_for_result(result['poll_url'])
59 print('Generation complete:', outputs)
60else:
61 print(f"Error: {response.status_code}")
62 print(response.text)API Endpoint
POST
https://api.segmind.com/workflows/692166176745e3e4213f5140-v2Parameters
Input_PromptoptionalstringInput Prompt
Default:
"combine all of these photos with exact facial reference, party night group photo with these characters with similar outfits\nthere should not be any repeated photos"Input_ImageoptionalarrayInput Image
Default:
["https://segmind-inference-inputs.s3.amazonaws.com/23844143-9aeb-482b-ab13-08b735d89afe-fc5e952c-b07a-4cf0-9797-cd0e1c43c1e9-a9a90fde-9db1-48ad-aec1-8ae136934732.webp","https://segmind-inference-inputs.s3.amazonaws.com/9a24d78c-0ab2-4c64-9573-308e6052997a-eb2920dc-b339-4982-8646-0be5e957d015.png","https://segmind-inference-inputs.s3.amazonaws.com/5bddf39b-5697-4b05-990d-a8118ccda276-2c9ca07d-2090-40c6-ba8d-d1fc8138c6d1-4f5f27be-f541-41d2-b494-d8032b68f68f.webp","https://segmind-inference-inputs.s3.amazonaws.com/28d9dc75-4f23-4740-9aeb-f0b07e501b1b-b1ea1613-d10b-4bab-b3a9-2fcfedc47e09-cf5d6d3d-9be2-4538-b6b2-3d8ff11594b9-Beach-walk.webp","https://segmind-inference-inputs.s3.amazonaws.com/e3ef9024-bea3-4b19-8e2a-c1452db92381-80871143-ba65-4eab-accd-e780f19c1f14-d475a23c-effb-45f5-a7a7-c16f42bd93c1.webp","https://segmind-inference-inputs.s3.amazonaws.com/009b37ae-47f2-4bc6-bf60-8ac3c1f35f2a-c4be44be-1e40-42d5-9d26-710ee76dbfb8-STYLE2.webp","https://segmind-inference-inputs.s3.amazonaws.com/9244c98d-1e05-47e4-98c3-0538256e48d6-b76f2d19-ae43-4ac4-a94e-0ec8106a031c-MODEL.webp","https://segmind-inference-inputs.s3.amazonaws.com/5e21b288-f207-4457-b124-3bb425b8c42a-a0587d02-9e44-40cc-8946-6d2f392cebd0-31933.webp","https://segmind-inference-inputs.s3.amazonaws.com/e8b9de29-8f6f-431a-9437-9a49d900642d-b8c87536-a411-4d66-b5f9-0688b7ee2f63-184cd917-6e26-4cfd-9dfd-134683780dfe.webp","https://segmind-inference-inputs.s3.amazonaws.com/013d19ea-b108-4de8-a453-33b187a3c65b-image (2).png"]Response Format
Returns: Polling-based asynchronous response
Initial request returns a poll_url. Poll every 7 seconds until status is COMPLETED.
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
400
Bad Request
Invalid parameters or request format
401
Unauthorized
Missing or invalid API key
403
Forbidden
Insufficient permissions
404
Not Found
Workflow not found
406
Insufficient Credits
Not enough credits to process request
429
Rate Limited
Too many requests
500
Server Error
Internal server error
502
Bad Gateway
Service temporarily unavailable
504
Timeout
Request timed out