Lyria 3 Song Generator: Turn Your Photos Into a Music Video Serverless API
Lyria 3 writes and sings an original song about your photos, then turns them into a 30-second music video. Upload three photos, describe the music you want, such as warm indie folk with a female vocal, and pick a visual style. Gemini 3.8 Flash directs the shots to the song, Nano Banana 2.1 restyles each photo, Gemini Omni 1.1 animates them, and the finished reel comes back scored by Lyria 3 and ready to post in 9:16 or 16:9. Perfect for travel memories, pets and celebrations.
1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/v2/6ad307cf4c8f0094c0814a12-v1"
7
8data = {
9 "photo_1": "https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/fe04594181e5ea8304864cfd63ac3379.jpeg",
10 "photo_2": "https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/82835979a6fdc93428266b501a7ffe3f.jpeg",
11 "photo_3": "https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/4308c4f8c2c86ea2e630039b7dc30253.jpeg",
12 "music_vibe": "Warm indie folk, nostalgic and hopeful, fingerpicked acoustic guitar, soft brushed drums, gentle female lead vocal",
13 "visual_style": "warm 35mm film look with soft grain, gentle halation and golden highlights",
14 "aspect_ratio": "9:16",
15 "resolution": "720p"
16}
17
18def poll_for_result(poll_url):
19 """Poll the API until the generation is complete"""
20 while True:
21 response = requests.get(
22 poll_url,
23 headers={'x-api-key': api_key}
24 )
25 result = response.json()
26
27 if result['status'] == 'COMPLETED':
28 # Parse the output (it's a JSON string)
29 outputs = json.loads(result['output'])
30 return outputs
31 elif result['status'] == 'FAILED':
32 raise Exception(result.get('error', 'Generation failed'))
33
34 # Wait 7 seconds before polling again
35 time.sleep(7)
36
37# Make the initial request
38response = requests.post(
39 url,
40 json=data,
41 headers={
42 'x-api-key': api_key,
43 'Content-Type': 'application/json'
44 }
45)
46
47if response.status_code == 200:
48 result = response.json()
49 print('Request queued:', result)
50
51 # Start polling for results
52 outputs = poll_for_result(result['poll_url'])
53 print('Generation complete:', outputs)
54else:
55 print(f"Error: {response.status_code}")
56 print(response.text) 1import requests
2import time
3import json
4
5api_key = "YOUR_API_KEY"
6url = "https://api.segmind.com/workflows/v2/6ad307cf4c8f0094c0814a12-v1"
7
8data = {
9 "photo_1": "https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/fe04594181e5ea8304864cfd63ac3379.jpeg",
10 "photo_2": "https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/82835979a6fdc93428266b501a7ffe3f.jpeg",
11 "photo_3": "https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/4308c4f8c2c86ea2e630039b7dc30253.jpeg",
12 "music_vibe": "Warm indie folk, nostalgic and hopeful, fingerpicked acoustic guitar, soft brushed drums, gentle female lead vocal",
13 "visual_style": "warm 35mm film look with soft grain, gentle halation and golden highlights",
14 "aspect_ratio": "9:16",
15 "resolution": "720p"
16}
17
18def poll_for_result(poll_url):
19 """Poll the API until the generation is complete"""
20 while True:
21 response = requests.get(
22 poll_url,
23 headers={'x-api-key': api_key}
24 )
25 result = response.json()
26
27 if result['status'] == 'COMPLETED':
28 # Parse the output (it's a JSON string)
29 outputs = json.loads(result['output'])
30 return outputs
31 elif result['status'] == 'FAILED':
32 raise Exception(result.get('error', 'Generation failed'))
33
34 # Wait 7 seconds before polling again
35 time.sleep(7)
36
37# Make the initial request
38response = requests.post(
39 url,
40 json=data,
41 headers={
42 'x-api-key': api_key,
43 'Content-Type': 'application/json'
44 }
45)
46
47if response.status_code == 200:
48 result = response.json()
49 print('Request queued:', result)
50
51 # Start polling for results
52 outputs = poll_for_result(result['poll_url'])
53 print('Generation complete:', outputs)
54else:
55 print(f"Error: {response.status_code}")
56 print(response.text)API Endpoint
https://api.segmind.com/workflows/v2/6ad307cf4c8f0094c0814a12-v1Parameters
photo_1optionalstring (uri)Photo 1
"https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/fe04594181e5ea8304864cfd63ac3379.jpeg"photo_2optionalstring (uri)Photo 2
"https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/82835979a6fdc93428266b501a7ffe3f.jpeg"photo_3optionalstring (uri)Photo 3
"https://images.segmind.com/generations/d09a086f-358d-4041-9ef1-4e5f3720bd74/4308c4f8c2c86ea2e630039b7dc30253.jpeg"music_vibeoptionalstringMusic Vibe
"Warm indie folk, nostalgic and hopeful, fingerpicked acoustic guitar, soft brushed drums, gentle female lead vocal"visual_styleoptionalstringVisual Style
"warm 35mm film look with soft grain, gentle halation and golden highlights"aspect_ratiooptionalstringAspect Ratio
"9:16"resolutionoptionalstringResolution
"720p"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.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Workflow not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out