# Sonilo Text to Sound Effects API

> Sonilo Text to Sound Effects generates a sound effect or ambience from a text description, from 1 second to 3 minutes long, as WAV, MP3, AAC or FLAC.

- Model ID: `sonilo/text-to-sfx`
- Provider: Sonilo
- Tasks: Sound Effects, Text to Sound Effects
- Price: $0.0018 per second of output. A 30-second output costs $0.054.
- Web page: https://scalingtensor.com/models/sonilo/text-to-sfx

## How to call it

Authenticate with the `apiKey` request header. Submit a job, then poll for the result:

1. `POST https://restapi.scalingtensor.com/api/media/generate` with JSON `{ "model": "<model ID>", "params": { ... } }`. The response `data.jobId` identifies the job.
2. `GET https://restapi.scalingtensor.com/api/media/result?jobId=<jobId>` until the status is `completed` or `failed`.
3. A response `code` of 0 means success; otherwise read `msg`.

```bash
curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
  --header 'apiKey: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "model": "sonilo/text-to-sfx",
  "params": {
    "prompt": "heavy rain on a tin roof with distant thunder",
    "duration": 10,
    "audio_format": "aac"
  }
}'
```

## Input parameters

Parameters go inside the `params` object.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | string | true | Text prompt describing the sound effect to generate. 1-2000 characters. |
| `duration` | integer | true | Desired duration of the output audio. Min 1 sec, max 180 sec. |
| `audio_format` | string | false | Output audio format. One of wav, mp3, aac, flac. Defaults to aac. |

## FAQ

### How much does the Sonilo Text to Sound Effects API cost?

Sonilo Text to Sound Effects costs $0.0018 per second of output on ScalingTensor. A 30-second output costs $0.054. There is no subscription; usage is charged to your prepaid wallet.

### How do I call the Sonilo Text to Sound Effects API?

Send POST /api/media/generate with "model": "sonilo/text-to-sfx" and the parameters in a params object, using your apiKey header. The call returns a jobId. Poll GET /api/media/result?jobId=... until the status is completed, then read the output URL from the result.

### Which parameters does Sonilo Text to Sound Effects accept?

Required: prompt and duration. Optional: audio_format. The parameter table on this page describes each one.

### Do I need a Sonilo account to use Sonilo Text to Sound Effects?

No. You call Sonilo Text to Sound Effects with your ScalingTensor API key and pay from your ScalingTensor wallet. The same key works for every other model in the catalog.
