---
title: "Replicate / Generate music"
description: "Replicate HTTP API tool replicate-music-generate on looot: input fields, $0.035 per result, output shape, and code to run it with curl, JavaScript or Python."
sidebar:
  hidden: true
---

{/* Generated by scripts/generate-api-reference.mjs from data/api-reference.json. Do not edit. */}

Generates music with MiniMax music-01 (from lyrics) or Stable Audio 2.5 (from a prompt) on Replicate. Send model_owner, model_name and input (the model's own inputs). The run is asynchronous; the result is the finished prediction with the audio URL in output. As the music.generate job it defaults to Stable Audio 2.5.

- **Tool id:** `replicate-music-generate`
- **Provider:** [Replicate HTTP API](/providers/replicate)
- **Job:** [Generate music from a prompt](/reference/jobs/music-generate) (`music.generate`)
- **Price:** $0.035 per result. A call that fails at the provider costs $0.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `input` | object | yes | The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or get the model version and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input. Files should be passed as HTTP URLs or data URLs. Use an HTTP URL when: - you have a large file &gt; 256kb - you want to be able to use... |
| `stream` | boolean | no | **This field is deprecated.** Request a URL to receive streaming output using [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). This field is no longer needed as the returned prediction will always have a `stream` entry in its `urls` property if the model supports streaming. |
| `webhook` | string | no | An HTTPS URL for receiving a webhook when the prediction has new output. The webhook will be a POST request where the request body is the same as the response body of the get prediction operation. If there are network problems, we will retry the webhook a few times, so make sure it can be safely called more than once. Replicate will not follow redirects when sending webhook requests to your service, so be sure to specify a... |
| `webhook_events_filter` | array | no | By default, we will send requests to your webhook URL whenever there are new outputs or the prediction has finished. You can change which events trigger webhook requests by specifying `webhook_events_filter` in the prediction request: - `start`: immediately on prediction start - `output`: each time a prediction generates an output (note that predictions can generate multiple outputs) - `logs`: each time log output is generated by a prediction - `completed`: when the prediction reaches a termi... |
| `model_name` | string | yes | Official model to run: minimax/music-01 ($0.035 per output audio file), stability-ai/stable-audio-2.5 ($0.2 per output audio file). |
| `model_owner` | string | yes | Owner of the official model. |

## Output

The run's `result` holds the provider's answer. Signed in, `looot inspect replicate-music-generate` prints its fields.

## Run it

Every call needs your API token in `LOOOT_TOKEN`; [Sign in](/get-started/sign-in#use-the-token-in-scripts-and-agents) shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With `wait: 30` the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll `GET /v1/runs/<runId>`.

Example input with placeholder values:

<CodeGroup>

```bash curl
curl -X POST "https://api.looot.ai/v1/runs" \
  -H "Authorization: Bearer $LOOOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"endpointId":"replicate-music-generate","input":{"model_owner":"<model_owner>","model_name":"<model_name>","input":{"prompt":"Tell me a joke","system_prompt":"You are a helpful assistant"},"webhook":"https://example.com/webhook","webhook_events_filter":["https://example.com/webhook","https://example.com/webhook"]},"wait":30}'
```

```js JavaScript
const response = await fetch("https://api.looot.ai/v1/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    endpointId: "replicate-music-generate",
    input: {
      model_owner: "<model_owner>",
      model_name: "<model_name>",
      input: {
        prompt: "Tell me a joke",
        system_prompt: "You are a helpful assistant",
      },
      webhook: "https://example.com/webhook",
      webhook_events_filter: ["https://example.com/webhook", "https://example.com/webhook"],
    },
    wait: 30,
  }),
});
const run = await response.json();
console.log(run.status, run.result);
```

```python Python
import os
import uuid

import requests

response = requests.post(
    "https://api.looot.ai/v1/runs",
    headers={
        "Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "endpointId": "replicate-music-generate",
        "input": {
            "model_owner": "<model_owner>",
            "model_name": "<model_name>",
            "input": {
                "prompt": "Tell me a joke",
                "system_prompt": "You are a helpful assistant",
            },
            "webhook": "https://example.com/webhook",
            "webhook_events_filter": ["https://example.com/webhook", "https://example.com/webhook"],
        },
        "wait": 30,
    },
    timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))
```

</CodeGroup>

To let looot pick among every provider of this job instead, send `job:music.generate` as `endpointId`; see [the job page](/reference/jobs/music-generate).
