{"openapi":"3.0.3","info":{"title":"audio","version":"1.0.0","description":"Convert text to natural speech, transcribe audio, analyze YouTube or direct-audio music references, and generate, master, and rank complete songs with flagship models."},"servers":[{"url":"https://audio.withzero.xyz"}],"paths":{"/api/v1/music-analyses":{"post":{"operationId":"post__api_v1_music_analyses","summary":"Analyze a public YouTube or direct-audio music reference, optionally combine Gemini semantics with local BPM/key/downbeat/loudness DSP, and return bar-aware sections plus a ready-to-generate original Lyria request.","x-payment-info":{"method":"tempo","currency":"USDC","amount":"0.02","sku":"audio.music-analysis-gemini-3-5-flash","pricingVersion":1},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"youtubeUrl":{"description":"Public YouTube video URL to analyze. Private and unlisted videos are not supported.","type":"string","maxLength":2048,"format":"uri"},"audioUrl":{"description":"Public HTTPS MP3/WAV/M4A/OGG/FLAC URL for hybrid semantic + DSP analysis.","type":"string","maxLength":2048,"format":"uri"},"audio":{"description":"Base64 MP3 or WAV for hybrid semantic + DSP analysis (15 MiB decoded maximum).","type":"string","minLength":1,"maxLength":21000000},"audioFormat":{"description":"Required when audio is supplied as base64.","type":"string","enum":["mp3","wav"]},"startSec":{"default":0,"description":"Start of the analyzed video window in whole seconds. Defaults to 0.","type":"integer","minimum":0,"maximum":21600},"endSec":{"default":300,"description":"End of the analyzed video window in whole seconds. Defaults to 300.","type":"integer","minimum":30,"maximum":21600},"targetDurationSec":{"description":"Optional duration for the compiled Lyria song; otherwise the detected music duration is used, clamped to 30–300 seconds.","type":"integer","minimum":30,"maximum":300},"instrumental":{"default":true,"description":"Compile an instrumental Lyria request by default; set false to permit original vocals.","type":"boolean"},"seed":{"description":"Optional best-effort Lyria seed copied into the compiled request.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"focus":{"description":"Optional analysis emphasis, for example \"prioritize the drums, bass groove, and chorus lift\".","type":"string","minLength":1,"maxLength":500},"analysisDepth":{"default":"standard","description":"Deep mode requests finer bar-level arrangement, envelope, and transition evidence.","type":"string","enum":["standard","deep"]},"sectionTargetCount":{"description":"Requested number of functional sections before the safety tail is appended.","type":"integer","minimum":2,"maximum":12},"barAlignment":{"default":"none","description":"Optionally snap compiled section boundaries to the detected musical grid. Omit to preserve the semantic timestamps.","type":"string","enum":["none","bar","4-bars","8-bars"]},"matchPriorities":{"type":"object","properties":{"groove":{"type":"integer","minimum":1,"maximum":5},"structure":{"type":"integer","minimum":1,"maximum":5},"harmony":{"type":"integer","minimum":1,"maximum":5},"instrumentation":{"type":"integer","minimum":1,"maximum":5},"production":{"type":"integer","minimum":1,"maximum":5}},"additionalProperties":false,"description":"Optional 1–5 importance weights. Higher-weight traits receive stronger analysis, prompting, and candidate-ranking emphasis."},"instrumentalLeadMode":{"default":"auto","description":"How analyzed vocal functions should become instrumental parts. Piano-led makes the main vocal role an expressive piano melody.","type":"string","enum":["auto","piano-led","synth-led","custom"]},"instrumentalLeadMapping":{"description":"Custom vocal-function mappings. These override the selected instrumentalLeadMode role by role.","minItems":1,"maxItems":8,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["lead","harmony","response","ad-lib","sustained","ensemble"],"description":"The source vocal function being reassigned."},"instrument":{"type":"string","minLength":1,"maxLength":80,"description":"Instrument that should perform this role, for example expressive piano or bright pluck synth."},"register":{"type":"string","enum":["low","mid","high","wide"]},"articulation":{"description":"Phrasing and envelope, for example clipped staccato attacks with short releases.","type":"string","minLength":1,"maxLength":160}},"required":["role","instrument"],"additionalProperties":false}},"instrumentalLeadContinuity":{"default":"persistent","description":"Persistent keeps the mapped lead instrument in front after every section transition in the compiled Lyria request.","type":"string","enum":["sectional","persistent"]},"tailReserveSec":{"default":0,"description":"Optionally reserve a non-essential final tail because Lyria can end several seconds early.","type":"integer","minimum":0,"maximum":15},"mastering":{"description":"Optional mastering controls copied into the ready-to-generate Lyria request.","type":"object","properties":{"targetLufs":{"default":-14,"description":"Target integrated loudness in LUFS.","type":"number","minimum":-24,"maximum":-8},"truePeakDb":{"default":-1,"description":"Maximum true peak in dBTP.","type":"number","minimum":-6,"maximum":-0.1},"fadeOutSec":{"default":1,"description":"Final fade duration in seconds.","type":"number","minimum":0,"maximum":10}},"required":["targetLufs","truePeakDb","fadeOutSec"],"additionalProperties":false}},"required":["startSec","endSec","instrumental","analysisDepth","barAlignment","instrumentalLeadMode","instrumentalLeadContinuity","tailReserveSec"],"additionalProperties":false,"example":{"youtubeUrl":"https://www.youtube.com/watch?v=example","startSec":0,"endSec":240,"targetDurationSec":180,"instrumental":true,"sectionTargetCount":8,"barAlignment":"4-bars","instrumentalLeadMode":"piano-led","tailReserveSec":5,"focus":"prioritize the drum pattern, bass movement, and energy changes"}}}}},"responses":{"200":{"description":"Successful response after payment","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"source":{"type":"object","properties":{"youtubeUrl":{"type":"string","format":"uri"},"audioUrl":{"type":"string","format":"uri"},"audioUpload":{"type":"boolean"},"startSec":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"endSec":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"analysisMethod":{"type":"string","enum":["gemini-video-semantic","gemini-audio-plus-dsp"]}},"required":["startSec","endSec","analysisMethod"],"additionalProperties":false},"analysis":{"type":"object","properties":{"durationSec":{"type":"integer","minimum":1,"maximum":600,"description":"Duration of the primary continuous musical performance inside the selected clip."},"clipMusicStartSec":{"type":"integer","minimum":0,"maximum":600,"description":"Where the primary music begins, relative to the selected clip."},"clipMusicEndSec":{"type":"integer","minimum":1,"maximum":600,"description":"Where the primary music ends, relative to the selected clip."},"tempo":{"type":"object","properties":{"bpm":{"type":"integer","minimum":40,"maximum":240,"description":"Most likely musical pulse in beats per minute."},"confidence":{"type":"number","minimum":0,"maximum":1},"alternativesBpm":{"maxItems":2,"type":"array","items":{"type":"integer","minimum":40,"maximum":240},"description":"Plausible half-time or double-time interpretations, if any."},"feel":{"type":"string","minLength":1,"maxLength":240,"description":"Rhythmic feel, swing, syncopation, and subdivision."}},"required":["bpm","confidence","alternativesBpm","feel"],"additionalProperties":false},"key":{"type":"object","properties":{"tonic":{"type":"string","minLength":1,"maxLength":8,"description":"Estimated tonic, using a note name such as C, F#, or Bb."},"mode":{"type":"string","minLength":1,"maxLength":32,"description":"Estimated mode such as major, minor, dorian, or mixolydian."},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["tonic","mode","confidence"],"additionalProperties":false},"timeSignature":{"type":"string","minLength":1,"maxLength":16},"genres":{"minItems":1,"maxItems":6,"type":"array","items":{"type":"string","minLength":1,"maxLength":80}},"moods":{"minItems":1,"maxItems":8,"type":"array","items":{"type":"string","minLength":1,"maxLength":80}},"drums":{"type":"string","minLength":1,"maxLength":600,"description":"Kit, pattern, subdivisions, fills, accents, and processing."},"bass":{"type":"string","minLength":1,"maxLength":600,"description":"Bass timbre, register, articulation, rhythm, and interaction with the kick."},"harmony":{"type":"string","minLength":1,"maxLength":600,"description":"Chord language, harmonic rhythm, voicing density, and tonal movement without transcribing the source."},"lead":{"type":"string","minLength":1,"maxLength":600,"description":"Lead timbres, melodic contour, phrasing density, and call-and-response without quoting the melody."},"vocalRoles":{"description":"Functional vocal parts that can be reassigned to instruments without copying the source melody.","maxItems":8,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["lead","harmony","response","ad-lib","sustained","ensemble"]},"description":{"type":"string","minLength":1,"maxLength":240,"description":"Register, phrasing density, articulation, envelope, and interaction of this vocal function."}},"required":["role","description"],"additionalProperties":false}},"vocalPerformance":{"description":"A non-note-level performance map used to make an instrument occupy the functional role of the source vocals.","type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":320,"description":"Phrase timing, breathing space, density, contour language, and handoffs without notes, intervals, lyrics, or melody transcription."},"phraseProfiles":{"minItems":1,"maxItems":16,"type":"array","items":{"type":"object","properties":{"sectionName":{"type":"string","minLength":1,"maxLength":64,"description":"Name of the arrangement section this performance profile belongs to."},"role":{"type":"string","enum":["lead","harmony","response","ad-lib","sustained","ensemble"]},"phraseBars":{"type":"integer","minimum":1,"maximum":8,"description":"Typical phrase length in bars, without transcribing notes or lyrics."},"pickup":{"type":"string","enum":["none","eighth-note","sixteenth-note","mixed"],"description":"Typical pickup behavior before phrase entrances."},"restBeats":{"type":"integer","minimum":0,"maximum":8,"description":"Typical breathing space after a phrase, in beats."},"density":{"type":"string","enum":["sparse","moderate","dense","rapid"],"description":"Relative event density of the vocal delivery."},"contour":{"minItems":1,"maxItems":4,"type":"array","items":{"type":"string","enum":["level","rising","falling","arch","inverted-arch","repeated-note","leap-and-answer","sustained"]},"description":"Ordered high-level contour gestures without pitches, intervals, or a melody transcription."},"cadence":{"type":"string","enum":["open","short-stop","falling-resolution","rising-lift","sustained-resolution"]},"delivery":{"type":"string","minLength":1,"maxLength":160,"description":"Articulation, attack, sustain, and dynamic behavior."},"handoff":{"type":"string","minLength":1,"maxLength":160,"description":"How this phrase yields to or answers another part."}},"required":["sectionName","role","phraseBars","pickup","restBeats","density","contour","cadence","delivery","handoff"],"additionalProperties":false}}},"required":["summary","phraseProfiles"],"additionalProperties":false},"instrumentation":{"minItems":1,"maxItems":16,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"production":{"type":"string","minLength":1,"maxLength":800,"description":"Mix, space, stereo field, dynamics, texture, transitions, and mastering character."},"energyArc":{"type":"string","minLength":1,"maxLength":600,"description":"How density and intensity change through the arrangement."},"signatureTraits":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":240},"description":"High-value abstract traits that explain the track identity without naming or copying protected expression."},"sections":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"startSec":{"type":"integer","minimum":0,"maximum":600,"description":"Section start relative to the beginning of the primary music, in whole seconds."},"endSec":{"type":"integer","minimum":1,"maximum":600,"description":"Section end relative to the beginning of the primary music, in whole seconds."},"name":{"type":"string","minLength":1,"maxLength":64,"description":"Functional section name such as Intro, Verse, Build, Chorus, Drop, Breakdown, Bridge, or Outro."},"description":{"type":"string","minLength":1,"maxLength":500,"description":"Section-specific rhythm, harmony, instrumentation, transition, and production traits."},"intensity":{"type":"integer","minimum":1,"maximum":10,"description":"Perceived intensity from 1 (minimal) to 10 (maximum)."},"startBar":{"description":"Approximate starting bar on the analyzed musical grid, when available.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"bars":{"description":"Approximate section length in bars, when available.","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["startSec","endSec","name","description","intensity"],"additionalProperties":false}},"overallConfidence":{"type":"number","minimum":0,"maximum":1},"warnings":{"maxItems":8,"type":"array","items":{"type":"string","minLength":1,"maxLength":240}}},"required":["durationSec","clipMusicStartSec","clipMusicEndSec","tempo","key","timeSignature","genres","moods","drums","bass","harmony","lead","instrumentation","production","energyArc","signatureTraits","sections","overallConfidence","warnings"],"additionalProperties":false},"dspEvidence":{"type":"object","properties":{"durationSec":{"type":"number","exclusiveMinimum":0},"tempo":{"type":"object","properties":{"bpm":{"type":"number","exclusiveMinimum":0},"beatOffsetSec":{"type":"number","minimum":0},"beatIntervalSec":{"type":"number","exclusiveMinimum":0},"downbeatOffsetBeats":{"type":"integer","minimum":0,"maximum":3},"downbeatConfidence":{"type":"number","minimum":0,"maximum":1}},"required":["bpm","beatOffsetSec","beatIntervalSec","downbeatOffsetBeats","downbeatConfidence"],"additionalProperties":false},"key":{"type":"object","properties":{"tonic":{"type":"string"},"mode":{"type":"string","enum":["major","minor"]},"camelot":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["tonic","mode","camelot","confidence"],"additionalProperties":false},"loudness":{"type":"object","properties":{"integratedLufs":{"type":"number"},"rangeLu":{"type":"number"},"truePeakDb":{"type":"number"}},"required":["integratedLufs","rangeLu","truePeakDb"],"additionalProperties":false},"stereo":{"type":"object","properties":{"correlation":{"type":"number","minimum":-1,"maximum":1},"sideToMidRatio":{"type":"number","minimum":0}},"required":["correlation","sideToMidRatio"],"additionalProperties":false},"brightness":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"energy":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"sections":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"startSec":{"type":"number","minimum":0},"endSec":{"type":"number","exclusiveMinimum":0}},"required":["kind","startSec","endSec"],"additionalProperties":false}},"cues":{"type":"object","properties":{"mixInSec":{"type":"number","minimum":0},"mixOutSec":{"type":"number","minimum":0}},"required":["mixInSec","mixOutSec"],"additionalProperties":false}},"required":["durationSec","tempo","brightness","energy","sections","cues"],"additionalProperties":false},"lyriaRequest":{"type":"object","properties":{"prompt":{"type":"string","minLength":1,"maxLength":4000},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"negativePrompt":{"type":"string","minLength":1,"maxLength":1000},"durationSec":{"type":"integer","minimum":30,"maximum":300},"instrumental":{"type":"boolean"},"instrumentalLeadMapping":{"maxItems":8,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["lead","harmony","response","ad-lib","sustained","ensemble"],"description":"The source vocal function being reassigned."},"instrument":{"type":"string","minLength":1,"maxLength":80,"description":"Instrument that should perform this role, for example expressive piano or bright pluck synth."},"register":{"type":"string","enum":["low","mid","high","wide"]},"articulation":{"description":"Phrasing and envelope, for example clipped staccato attacks with short releases.","type":"string","minLength":1,"maxLength":160}},"required":["role","instrument"],"additionalProperties":false}},"instrumentalLeadContinuity":{"type":"string","enum":["sectional","persistent"]},"tailReserveSec":{"type":"integer","minimum":0,"maximum":15},"temperature":{"type":"number","minimum":0,"maximum":2},"topP":{"type":"number","minimum":0,"maximum":1},"sections":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"startSec":{"type":"integer","minimum":0,"maximum":300},"endSec":{"type":"integer","minimum":1,"maximum":300},"name":{"type":"string"},"description":{"type":"string"},"intensity":{"type":"integer","minimum":1,"maximum":10}},"required":["startSec","endSec","name","description","intensity"],"additionalProperties":false}},"mastering":{"type":"object","properties":{"targetLufs":{"default":-14,"description":"Target integrated loudness in LUFS.","type":"number","minimum":-24,"maximum":-8},"truePeakDb":{"default":-1,"description":"Maximum true peak in dBTP.","type":"number","minimum":-6,"maximum":-0.1},"fadeOutSec":{"default":1,"description":"Final fade duration in seconds.","type":"number","minimum":0,"maximum":10}},"required":["targetLufs","truePeakDb","fadeOutSec"],"additionalProperties":false},"selectionTarget":{"type":"object","properties":{"bpm":{"type":"number","minimum":40,"maximum":240},"matchPriorities":{"type":"object","properties":{"groove":{"type":"integer","minimum":1,"maximum":5},"structure":{"type":"integer","minimum":1,"maximum":5},"harmony":{"type":"integer","minimum":1,"maximum":5},"instrumentation":{"type":"integer","minimum":1,"maximum":5},"production":{"type":"integer","minimum":1,"maximum":5}},"additionalProperties":false,"description":"Optional 1–5 importance weights. Higher-weight traits receive stronger analysis, prompting, and candidate-ranking emphasis."}},"required":["bpm"],"additionalProperties":false}},"required":["prompt","negativePrompt","durationSec","instrumental","temperature","topP","sections"],"additionalProperties":false,"description":"Ready to POST to /api/v1/songs/lyria-3-pro."},"limitations":{"type":"array","items":{"type":"string"}},"model":{"type":"string"},"price_usdc":{"type":"string"}},"required":["source","analysis","lyriaRequest","limitations","model","price_usdc"],"additionalProperties":false}}}},"402":{"$ref":"#/components/schemas/PaymentRequired"}}}},"/api/v1/speech/gemini-3.1-flash-tts":{"post":{"operationId":"post__api_v1_speech_gemini_3_1_flash_tts","summary":"Convert text to natural-sounding speech with Google Gemini 3.1 Flash TTS and return a hosted audio URL.","x-payment-info":{"method":"tempo","currency":"USDC","amount":"0.04","sku":"audio.gemini-3.1-flash-tts","pricingVersion":1},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"input":{"type":"string","minLength":1,"maxLength":4000,"description":"The text to convert to speech (1–4000 characters)."},"voice":{"default":"Kore","description":"Voice to speak with. Defaults to \"Kore\".","type":"string","minLength":1,"maxLength":64}},"required":["input","voice"],"additionalProperties":false,"example":{"input":"Hello from WithZero — this is a text to speech sample."}}}}},"responses":{"200":{"description":"Successful response after payment","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","description":"Hosted URL of the generated audio (WAV, 24kHz mono)."},"mimeType":{"type":"string","description":"Content type of the generated audio."},"sizeBytes":{"type":"number","description":"Size of the generated audio in bytes."},"seconds":{"type":"number","description":"Approximate duration of the generated audio in seconds."},"model":{"type":"string","description":"The model that produced the audio."},"price_usdc":{"type":"string","description":"The amount charged for this request, in USDC."}},"required":["url","mimeType","sizeBytes","seconds","model","price_usdc"],"additionalProperties":false}}}},"402":{"$ref":"#/components/schemas/PaymentRequired"}}}},"/api/v1/speech/grok-voice":{"post":{"operationId":"post__api_v1_speech_grok_voice","summary":"Convert text to natural-sounding speech with xAI's Grok Voice and return a hosted audio URL.","x-payment-info":{"method":"tempo","currency":"USDC","amount":"0.02","sku":"audio.grok-voice","pricingVersion":1},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"input":{"type":"string","minLength":1,"maxLength":4000,"description":"The text to convert to speech (1–4000 characters)."},"voice":{"default":"default","description":"Voice to speak with. Defaults to \"default\".","type":"string","minLength":1,"maxLength":64}},"required":["input","voice"],"additionalProperties":false,"example":{"input":"Hello from WithZero — this is a text to speech sample."}}}}},"responses":{"200":{"description":"Successful response after payment","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","description":"Hosted URL of the generated audio (WAV, 24kHz mono)."},"mimeType":{"type":"string","description":"Content type of the generated audio."},"sizeBytes":{"type":"number","description":"Size of the generated audio in bytes."},"seconds":{"type":"number","description":"Approximate duration of the generated audio in seconds."},"model":{"type":"string","description":"The model that produced the audio."},"price_usdc":{"type":"string","description":"The amount charged for this request, in USDC."}},"required":["url","mimeType","sizeBytes","seconds","model","price_usdc"],"additionalProperties":false}}}},"402":{"$ref":"#/components/schemas/PaymentRequired"}}}},"/api/v1/transcripts/whisper-large-v3":{"post":{"operationId":"post__api_v1_transcripts_whisper_large_v3","summary":"Transcribe spoken audio to text with OpenAI Whisper Large v3.","x-payment-info":{"method":"tempo","currency":"USDC","amount":"0.002","sku":"audio.whisper-large-v3","pricingVersion":1},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"audio":{"type":"string","minLength":1,"maxLength":20971524,"description":"Base64-encoded audio to transcribe (decoded size up to 15 MB)."},"format":{"type":"string","enum":["wav","mp3"],"description":"Container format of the audio."}},"required":["audio","format"],"additionalProperties":false,"example":{"audio":"UklGRiYAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQIAAAAAAA==","format":"wav"}}}}},"responses":{"200":{"description":"Successful response after payment","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","description":"The transcript of the audio."},"seconds":{"type":"number","description":"Detected duration of the input audio in seconds."},"model":{"type":"string","description":"The model that produced the transcript."},"price_usdc":{"type":"string","description":"The amount charged for this request, in USDC."}},"required":["text","seconds","model","price_usdc"],"additionalProperties":false}}}},"402":{"$ref":"#/components/schemas/PaymentRequired"}}}},"/api/v1/transcripts/gpt-4o-transcribe":{"post":{"operationId":"post__api_v1_transcripts_gpt_4o_transcribe","summary":"Transcribe spoken audio to text with OpenAI's GPT-4o Transcribe.","x-payment-info":{"method":"tempo","currency":"USDC","amount":"0.005","sku":"audio.gpt-4o-transcribe","pricingVersion":1},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"audio":{"type":"string","minLength":1,"maxLength":20971524,"description":"Base64-encoded audio to transcribe (decoded size up to 15 MB)."},"format":{"type":"string","enum":["wav","mp3"],"description":"Container format of the audio."}},"required":["audio","format"],"additionalProperties":false,"example":{"audio":"UklGRiYAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQIAAAAAAA==","format":"wav"}}}}},"responses":{"200":{"description":"Successful response after payment","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","description":"The transcript of the audio."},"seconds":{"type":"number","description":"Detected duration of the input audio in seconds."},"model":{"type":"string","description":"The model that produced the transcript."},"price_usdc":{"type":"string","description":"The amount charged for this request, in USDC."}},"required":["text","seconds","model","price_usdc"],"additionalProperties":false}}}},"402":{"$ref":"#/components/schemas/PaymentRequired"}}}},"/api/v1/songs/lyria-3-pro":{"post":{"operationId":"post__api_v1_songs_lyria_3_pro","summary":"Generate one to three complete songs with Google's Lyria 3 Pro, optionally translate vocal functions into instruments, master the audio, rank candidates with local DSP, and return hosted audio URLs.","x-payment-info":{"method":"tempo","currency":"USDC","amount":"0.08","sku":"audio.lyria-3-pro","pricingVersion":1},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"prompt":{"type":"string","minLength":1,"maxLength":4000,"description":"Text description of the song to generate (1–4000 characters)."},"seed":{"description":"Seed for repeatable generation (best effort).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"negativePrompt":{"description":"Elements to discourage, appended to the Lyria prompt as explicit exclusions.","type":"string","minLength":1,"maxLength":1000},"durationSec":{"description":"Target duration in seconds (30–300; best effort).","type":"integer","minimum":30,"maximum":300},"instrumental":{"description":"When true, explicitly excludes vocals, speech, vocal chops, and choir.","type":"boolean"},"instrumentalLeadMapping":{"description":"Map source vocal functions to instrumental parts such as lead → expressive piano and harmony → warm strings.","minItems":1,"maxItems":8,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["lead","harmony","response","ad-lib","sustained","ensemble"],"description":"The source vocal function being reassigned."},"instrument":{"type":"string","minLength":1,"maxLength":80,"description":"Instrument that should perform this role, for example expressive piano or bright pluck synth."},"register":{"type":"string","enum":["low","mid","high","wide"]},"articulation":{"description":"Phrasing and envelope, for example clipped staccato attacks with short releases.","type":"string","minLength":1,"maxLength":160}},"required":["role","instrument"],"additionalProperties":false}},"instrumentalLeadContinuity":{"description":"How strongly to retain the mapped lead instrument. Persistent reasserts it after every transition and prevents another instrument from replacing it.","type":"string","enum":["sectional","persistent"]},"tailReserveSec":{"description":"Reserve the final seconds for non-essential decay so an early model stop does not remove the musical resolution.","type":"integer","minimum":0,"maximum":15},"temperature":{"description":"OpenRouter sampling temperature from 0 to 2.","type":"number","minimum":0,"maximum":2},"topP":{"description":"OpenRouter nucleus-sampling probability from 0 to 1.","type":"number","minimum":0,"maximum":1},"candidateCount":{"default":1,"description":"Generate 1–3 seeded candidates. Extra candidates cost the normal per-song price; the objectively closest result is returned at top level.","type":"integer","minimum":1,"maximum":3},"mastering":{"description":"Optional ffmpeg loudness normalization, true-peak control, and final fade. Omit to return Lyria audio unchanged.","type":"object","properties":{"targetLufs":{"default":-14,"description":"Target integrated loudness in LUFS.","type":"number","minimum":-24,"maximum":-8},"truePeakDb":{"default":-1,"description":"Maximum true peak in dBTP.","type":"number","minimum":-6,"maximum":-0.1},"fadeOutSec":{"default":1,"description":"Final fade duration in seconds.","type":"number","minimum":0,"maximum":10}},"required":["targetLufs","truePeakDb","fadeOutSec"],"additionalProperties":false},"selectionTarget":{"description":"Optional BPM and match weights used to rank multiple candidates with local DSP.","type":"object","properties":{"bpm":{"type":"number","minimum":40,"maximum":240},"matchPriorities":{"type":"object","properties":{"groove":{"type":"integer","minimum":1,"maximum":5},"structure":{"type":"integer","minimum":1,"maximum":5},"harmony":{"type":"integer","minimum":1,"maximum":5},"instrumentation":{"type":"integer","minimum":1,"maximum":5},"production":{"type":"integer","minimum":1,"maximum":5}},"additionalProperties":false,"description":"Optional 1–5 importance weights. Higher-weight traits receive stronger analysis, prompting, and candidate-ranking emphasis."}},"additionalProperties":false},"referenceImageUrls":{"description":"Up to 10 public reference images to guide mood, visual story, and style.","maxItems":10,"type":"array","items":{"type":"string","maxLength":2048,"format":"uri"}},"sections":{"description":"Up to 20 ordered, non-overlapping arrangement sections converted to Lyria timestamp directives.","maxItems":20,"type":"array","items":{"type":"object","properties":{"startSec":{"type":"integer","minimum":0,"maximum":300,"description":"Inclusive section start in whole seconds."},"endSec":{"type":"integer","minimum":1,"maximum":300,"description":"Exclusive section end in whole seconds."},"name":{"type":"string","minLength":1,"maxLength":64,"description":"Section label, for example Intro, Verse, Chorus, or Bridge."},"description":{"type":"string","minLength":1,"maxLength":500,"description":"Instrumentation, melody, rhythm, and production instructions for this section."},"intensity":{"description":"Target section intensity from 1 (minimal) to 10 (maximum).","type":"integer","minimum":1,"maximum":10}},"required":["startSec","endSec","name","description"],"additionalProperties":false}}},"required":["prompt","candidateCount"],"additionalProperties":false,"example":{"prompt":"A short upbeat synthwave instrumental with a driving bassline"}}}}},"responses":{"200":{"description":"Successful response after payment","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","description":"Hosted URL of the generated song (MP3)."},"mimeType":{"type":"string","description":"Content type of the generated audio."},"sizeBytes":{"type":"number","description":"Size of the generated audio in bytes."},"seconds":{"type":"number","description":"Approximate duration of the song in seconds."},"model":{"type":"string","description":"The model that produced the song."},"price_usdc":{"type":"string","description":"The amount charged for this request, in USDC."},"selectedCandidate":{"description":"Zero-based selected candidate index when candidateCount is greater than one.","type":"integer","minimum":0,"maximum":9007199254740991},"selectionMethod":{"type":"string","const":"local-dsp"},"selectionNotes":{"type":"array","items":{"type":"string"}},"generationFailures":{"type":"integer","minimum":0,"maximum":9007199254740991},"diagnostics":{"type":"object","properties":{"beforeMastering":{"type":"object","properties":{"durationSec":{"type":"number","exclusiveMinimum":0},"tempo":{"type":"object","properties":{"bpm":{"type":"number","exclusiveMinimum":0},"beatOffsetSec":{"type":"number","minimum":0},"beatIntervalSec":{"type":"number","exclusiveMinimum":0},"downbeatOffsetBeats":{"type":"integer","minimum":0,"maximum":3},"downbeatConfidence":{"type":"number","minimum":0,"maximum":1}},"required":["bpm","beatOffsetSec","beatIntervalSec","downbeatOffsetBeats","downbeatConfidence"],"additionalProperties":false},"key":{"type":"object","properties":{"tonic":{"type":"string"},"mode":{"type":"string","enum":["major","minor"]},"camelot":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["tonic","mode","camelot","confidence"],"additionalProperties":false},"loudness":{"type":"object","properties":{"integratedLufs":{"type":"number"},"rangeLu":{"type":"number"},"truePeakDb":{"type":"number"}},"required":["integratedLufs","rangeLu","truePeakDb"],"additionalProperties":false},"stereo":{"type":"object","properties":{"correlation":{"type":"number","minimum":-1,"maximum":1},"sideToMidRatio":{"type":"number","minimum":0}},"required":["correlation","sideToMidRatio"],"additionalProperties":false},"brightness":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"energy":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"sections":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"startSec":{"type":"number","minimum":0},"endSec":{"type":"number","exclusiveMinimum":0}},"required":["kind","startSec","endSec"],"additionalProperties":false}},"cues":{"type":"object","properties":{"mixInSec":{"type":"number","minimum":0},"mixOutSec":{"type":"number","minimum":0}},"required":["mixInSec","mixOutSec"],"additionalProperties":false}},"required":["durationSec","tempo","brightness","energy","sections","cues"],"additionalProperties":false},"final":{"type":"object","properties":{"durationSec":{"type":"number","exclusiveMinimum":0},"tempo":{"type":"object","properties":{"bpm":{"type":"number","exclusiveMinimum":0},"beatOffsetSec":{"type":"number","minimum":0},"beatIntervalSec":{"type":"number","exclusiveMinimum":0},"downbeatOffsetBeats":{"type":"integer","minimum":0,"maximum":3},"downbeatConfidence":{"type":"number","minimum":0,"maximum":1}},"required":["bpm","beatOffsetSec","beatIntervalSec","downbeatOffsetBeats","downbeatConfidence"],"additionalProperties":false},"key":{"type":"object","properties":{"tonic":{"type":"string"},"mode":{"type":"string","enum":["major","minor"]},"camelot":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["tonic","mode","camelot","confidence"],"additionalProperties":false},"loudness":{"type":"object","properties":{"integratedLufs":{"type":"number"},"rangeLu":{"type":"number"},"truePeakDb":{"type":"number"}},"required":["integratedLufs","rangeLu","truePeakDb"],"additionalProperties":false},"stereo":{"type":"object","properties":{"correlation":{"type":"number","minimum":-1,"maximum":1},"sideToMidRatio":{"type":"number","minimum":0}},"required":["correlation","sideToMidRatio"],"additionalProperties":false},"brightness":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"energy":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"sections":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"startSec":{"type":"number","minimum":0},"endSec":{"type":"number","exclusiveMinimum":0}},"required":["kind","startSec","endSec"],"additionalProperties":false}},"cues":{"type":"object","properties":{"mixInSec":{"type":"number","minimum":0},"mixOutSec":{"type":"number","minimum":0}},"required":["mixInSec","mixOutSec"],"additionalProperties":false}},"required":["durationSec","tempo","brightness","energy","sections","cues"],"additionalProperties":false}},"required":["final"],"additionalProperties":false},"candidates":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"maximum":9007199254740991},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"},"sizeBytes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"seconds":{"type":"number","exclusiveMinimum":0},"score":{"type":"object","properties":{"overall":{"type":"number","minimum":0,"maximum":1},"duration":{"type":"number","minimum":0,"maximum":1},"groove":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"structure":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"production":{"type":"number","minimum":0,"maximum":1}},"required":["overall","duration","groove","structure","production"],"additionalProperties":false},"diagnostics":{"type":"object","properties":{"durationSec":{"type":"number","exclusiveMinimum":0},"tempo":{"type":"object","properties":{"bpm":{"type":"number","exclusiveMinimum":0},"beatOffsetSec":{"type":"number","minimum":0},"beatIntervalSec":{"type":"number","exclusiveMinimum":0},"downbeatOffsetBeats":{"type":"integer","minimum":0,"maximum":3},"downbeatConfidence":{"type":"number","minimum":0,"maximum":1}},"required":["bpm","beatOffsetSec","beatIntervalSec","downbeatOffsetBeats","downbeatConfidence"],"additionalProperties":false},"key":{"type":"object","properties":{"tonic":{"type":"string"},"mode":{"type":"string","enum":["major","minor"]},"camelot":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["tonic","mode","camelot","confidence"],"additionalProperties":false},"loudness":{"type":"object","properties":{"integratedLufs":{"type":"number"},"rangeLu":{"type":"number"},"truePeakDb":{"type":"number"}},"required":["integratedLufs","rangeLu","truePeakDb"],"additionalProperties":false},"stereo":{"type":"object","properties":{"correlation":{"type":"number","minimum":-1,"maximum":1},"sideToMidRatio":{"type":"number","minimum":0}},"required":["correlation","sideToMidRatio"],"additionalProperties":false},"brightness":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"energy":{"type":"array","items":{"type":"number","minimum":0,"maximum":1}},"sections":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"startSec":{"type":"number","minimum":0},"endSec":{"type":"number","exclusiveMinimum":0}},"required":["kind","startSec","endSec"],"additionalProperties":false}},"cues":{"type":"object","properties":{"mixInSec":{"type":"number","minimum":0},"mixOutSec":{"type":"number","minimum":0}},"required":["mixInSec","mixOutSec"],"additionalProperties":false}},"required":["durationSec","tempo","brightness","energy","sections","cues"],"additionalProperties":false}},"required":["index","url","sizeBytes","seconds","score","diagnostics"],"additionalProperties":false}}},"required":["url","mimeType","sizeBytes","seconds","model","price_usdc"],"additionalProperties":false}}}},"402":{"$ref":"#/components/schemas/PaymentRequired"}}}}},"components":{"schemas":{"PaymentRequired":{"type":"object","description":"x402/MPP 402 advertisement. Decode the PAYMENT-REQUIRED or WWW-Authenticate header for payment requirements.","properties":{"error":{"type":"string"}}}}}}