POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 const axios = require('axios'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/sonilo-text-to-audio"; const data = {}; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


promptstr *

Describes the music or sound effect to generate. Name genre, mood, and instruments.


sound_typestr ( default: music )

Chooses music or sfx mode, setting valid durations and formats. Pick sfx for effects.


durationint ( default: 30 )

Output length in seconds: music 5-360, sfx 1-180. Use 15-30 for clips.


output_formatstr ( default: wav )

Audio format: music m4a or wav; sfx wav, mp3, aac, flac. Use mp3 for web.


music_segmentslist ( default: 1 )

Optional timed prompts (music only); space starts 5s apart. Use for evolving tracks.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Sonilo Text to Audio: AI Music and Sound Effect Generator

What is Sonilo Text to Audio?

Sonilo Text to Audio is a text-to-audio model that turns a plain-language prompt into a finished music track or a production-ready sound effect. A single sound_type switch flips the model between two modes: music, which composes full instrumental tracks, and sfx, which renders discrete effects like footsteps, impacts, ambience, UI clicks, and transitions. Because Sonilo is trained on licensed catalogs rather than scraped audio, the output is commercial-use safe, making it a practical choice for teams that need royalty-free background music and sound design they can ship.

If you have searched for an AI music generator, a text-to-music API, or an AI sound effects generator, this model covers both jobs behind one endpoint, with exact duration control and multiple export formats.

Key Features

  • Two generators in one: text-to-music and text-to-sfx, selected with sound_type.
  • Exact length control via duration: 5-360 seconds for music, 1-180 seconds for sound effects.
  • Format flexibility: music exports as m4a or wav; SFX exports as wav, mp3, aac, or flac.
  • Timed music_segments let you script mood or instrumentation changes across a single track.
  • Licensed, commercial-use-safe output suitable for ads, apps, and monetized channels.

Best Use Cases

Generate background beds for short-form video, product launches, explainers, and social cutdowns. Create loopable game and app audio, or batch discrete sound effects for interfaces and cinematic hits. In testing, a descriptive lofi prompt returned a clean 30-second stereo track (44.1 kHz) with no clipping or artifacts, confirming it is ready for direct use in edits and creator workflows.

Prompt Tips and Output Quality

Write a comma-separated brief that names genre, mood, instrumentation, and texture, for example warm lofi piano, soft vinyl crackle, relaxed drums. Keep SFX prompts concrete and physical. For a music track that evolves, add music_segments with start times at least five seconds apart. Longer durations give arrangements room to develop.

FAQs

Is Sonilo Text to Audio royalty-free? Yes. It is trained on licensed catalogs and the output is commercial-use safe.

Can it make sound effects, not just music? Yes. Set sound_type to sfx to generate effects from a text prompt.

How long can the audio be? Music runs 5 to 360 seconds; sound effects run 1 to 180 seconds.

Which output formats are supported? Music returns m4a or wav; SFX returns wav, mp3, aac, or flac.

Does it need vocals or lyrics? No. It generates instrumental music and sound effects, not sung lyrics.