---
title: Producer Testo in musica | RunAPI
description: Usa l'endpoint da testo a musica per creare un Task asincrono.
url: https://runapi.ai/it/docs/api/producer/text-to-music.md
canonical: https://runapi.ai/it/docs/api/producer/text-to-music
locale: it
---

> Versione HTML: https://runapi.ai/it/docs/api/producer/text-to-music
> Indice del sito per gli agenti: https://runapi.ai/llms.txt

# Producer Testo in musica

## Panoramica

Usa l'endpoint da testo a musica con un modello supportato. Utilizza il Task ID restituito per recuperarne lo stato, oppure fornisci callback_url per le consegne documentate di seguito.

### Avvio rapido

1. Crea una Chiave API e impostala come RUNAPI_API_KEY.
2. Scegli un modello supportato e invia una richiesta POST il cui corpo corrisponda allo schema di quel modello.
3. Conserva l'ID attività restituito, quindi esegui il polling fino a uno stato terminale o gestisci i callback documentati di seguito.

## Endpoint

POST /api/v1/producer/text_to_music

URL di base: https://runapi.ai

Versione API: v1

Autenticazione: Authorization: Bearer YOUR_API_TOKEN

## Modelli supportati

Apri la pagina di un modello per i prezzi correnti, i limiti di frequenza e i dettagli sull'uso commerciale.

- [fuzz-0.8](https://runapi.ai/it/models/producer/fuzz-0.8)
- [fuzz-1.0](https://runapi.ai/it/models/producer/fuzz-1.0)
- [fuzz-1.0-pro](https://runapi.ai/it/models/producer/fuzz-1.0-pro)
- [fuzz-1.1](https://runapi.ai/it/models/producer/fuzz-1.1)
- [fuzz-1.1-pro](https://runapi.ai/it/models/producer/fuzz-1.1-pro)
- [fuzz-2.0](https://runapi.ai/it/models/producer/fuzz-2.0)
- [fuzz-2.0-pro](https://runapi.ai/it/models/producer/fuzz-2.0-pro)
- [fuzz-2.0-raw](https://runapi.ai/it/models/producer/fuzz-2.0-raw)

## Schema della richiesta

I campi e i valori consentiti dipendono dal modello selezionato. Se fornito, callback_url riceve le notifiche Task documentate di seguito.

### fuzz-0.8

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.0

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.0-pro

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.1

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.1-pro

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-2.0

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-2.0-pro

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-2.0-raw

```json
{
  "callback_url": {
    "description": "URL webhook per notifiche asincrone.",
    "type": "string"
  },
  "lyrics": {
    "description": "Testo esatto dei testi da cantare.",
    "type": "string"
  },
  "model": {
    "description": "Slug del modello.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Stile musicale e brief di produzione.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Titolo musicale.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Modalità di generazione vocale.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

#### Regole condizionali

Questi requisiti si applicano quando tutte le condizioni elencate corrispondono.

- **Quando**: `vocal_mode` = `exact_lyrics`; **Obbligatorio**: `lyrics`
- **Quando**: `vocal_mode` = `instrumental`; **Non accettato**: `lyrics`

## Crea accettazione

HTTP 202 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Polling in elaborazione

HTTP 200 - GET /api/v1/producer/text_to_music/:id

### Schema della risposta

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Polling completato

HTTP 200 - GET /api/v1/producer/text_to_music/:id

### Schema della risposta

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration_seconds": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "audio_url",
          "model_name"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "generation_stage": {
      "enum": [
        "all_audios_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "generation_stage",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "duration_seconds": 78.36,
      "id": "audio_reference",
      "image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
      "lyrics": "[Instrumental]",
      "model_name": "fuzz-2.0",
      "title": "Soft Piano"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "generation_stage": "all_audios_ready",
  "id": "tsk_reference_demo",
  "status": "completed"
}
```

## Polling non riuscito

HTTP 200 - GET /api/v1/producer/text_to_music/:id

### Schema della risposta

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "generation_stage": {
      "enum": [
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "generation_stage",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "generation_stage": "failed",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Callback cliente: completato

HTTP 200 - POST callback_url

### Schema della risposta

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration_seconds": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "audio_url",
          "model_name"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "all_audios_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "generation_stage",
    "audios"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "duration_seconds": 78.36,
      "id": "audio_reference",
      "image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
      "lyrics": "[Instrumental]",
      "model_name": "fuzz-2.0",
      "title": "Soft Piano"
    }
  ],
  "generation_stage": "all_audios_ready",
  "id": "tsk_reference_demo",
  "status": "completed"
}
```

## Callback cliente: fallito

HTTP 200 - POST callback_url

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "generation_stage": {
      "enum": [
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "generation_stage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "generation_stage": "failed",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Errori

HTTP 401 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Authentication required"
}
```

## Errori

HTTP 401 - GET /api/v1/producer/text_to_music/:id

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Authentication required"
}
```

## Errori

HTTP 400 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Messaggio di errore leggibile.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Riepilogo di convalida leggibile dall'utente.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Messaggi di convalida con chiave per campo della richiesta pubblica, con un array di stringhe leggibili dall'utente per ogni campo.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### Esempio di risposta

```json
{
  "error": "model must be one of: fuzz-0.8, fuzz-1.0, fuzz-1.0-pro, fuzz-1.1, fuzz-1.1-pro, fuzz-2.0, fuzz-2.0-pro, fuzz-2.0-raw"
}
```

## Errori

HTTP 402 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Insufficient balance"
}
```

## Errori

HTTP 429 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "API key credit limit exceeded"
}
```

## Errori

HTTP 409 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## Errori

HTTP 429 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## Errori

HTTP 503 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## Errori

HTTP 504 - POST /api/v1/producer/text_to_music

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "The request timed out"
}
```

## Errori

HTTP 404 - GET /api/v1/producer/text_to_music/:id

### Schema della risposta

```json
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Esempio di risposta

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## Esempi di Codice Generati

Usa cURL direttamente, oppure installa un SDK per il tuo linguaggio. Ogni esempio invia la richiesta validata mostrata in questo riferimento.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/producer/text_to_music \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"fuzz-2.0","vocal_mode":"instrumental","prompt":"Soft piano with gentle percussion."}'
```

### javascript

#### Installa

```bash
npm install @runapi.ai/producer
```

```javascript
import { ProducerClient } from "@runapi.ai/producer";

const client = new ProducerClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.textToMusic.create({
  "model": "fuzz-2.0",
  "vocal_mode": "instrumental",
  "prompt": "Soft piano with gentle percussion."
});
```

### python

#### Installa

```bash
pip install runapi-producer
```

```python
import os
from runapi.producer import ProducerClient

client = ProducerClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_music.create(
  model="fuzz-2.0",
  vocal_mode="instrumental",
  prompt="Soft piano with gentle percussion."
)
```

### go

#### Installa

```bash
go get github.com/runapi-ai/producer-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  producer "github.com/runapi-ai/producer-sdk/go/producer"
)

func main() {
  client, err := producer.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.TextToMusic.Create(context.Background(), producer.TextToMusicParams{
    Model: producer.ProducerModel("fuzz-2.0"),
    VocalMode: producer.VocalMode("instrumental"),
    Prompt: "Soft piano with gentle percussion.",
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### Installa

```bash
gem install runapi-producer
```

```ruby
require "runapi/producer"

client = RunApi::Producer::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.text_to_music.create(
  model: "fuzz-2.0",
  vocal_mode: "instrumental",
  prompt: "Soft piano with gentle percussion."
)
```

### java

#### Installa

```kotlin
implementation("ai.runapi:runapi-producer")
```

```java
import ai.runapi.producer.ProducerClient;
import ai.runapi.producer.types.TextToMusicParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    ProducerClient client = ProducerClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.textToMusic().create(
        TextToMusicParams.builder()
        .model("fuzz-2.0")
        .vocalMode("instrumental")
        .prompt("Soft piano with gentle percussion.")
            .build()
    );
  }
}
```

### php

#### Installa

```bash
composer require runapi-ai/producer
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\Producer\ProducerClient;

$client = new ProducerClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->textToMusic->create([
  "model" => "fuzz-2.0",
  "vocal_mode" => "instrumental",
  "prompt" => "Soft piano with gentle percussion."
]);
```

## Guide correlate

- [Autenticazione](https://runapi.ai/it/docs/guides/authentication.md)
- [Guida introduttiva](https://runapi.ai/it/docs/guides/task-api/quickstart.md)

---

## Altre risorse di RunAPI

- [Home](https://runapi.ai/it/.md)
- [Catalogo dei modelli](https://runapi.ai/it/models.md)
- [Prezzi](https://runapi.ai/it/pricing.md)
- [Fornitori](https://runapi.ai/it/models)
- [Documentazione](https://runapi.ai/it/docs/guides)
- [SDK](https://runapi.ai/it/sdk.md)
- [CLI](https://runapi.ai/it/cli.md)
- [MCP Server](https://runapi.ai/it/mcp.md)
- [Claude Code vs Cursor](https://runapi.ai/it/claude-code-vs-cursor.md)
- [Configurazione Cursor API](https://runapi.ai/it/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/it/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/it/contact.md)
- [Contatti](https://runapi.ai/it/contact.md)
- [Termini](https://runapi.ai/it/terms.md)
- [Privacy](https://runapi.ai/it/privacy.md)
- [Indice del sito per gli agenti](https://runapi.ai/llms.txt)

Contatti: contact@runapi.ai

## Dati strutturati

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "it",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/it",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/it/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "it",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/it",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/iticon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "it",
    "@type": "TechArticle",
    "headline": "Producer Testo in musica",
    "description": "Usa l'endpoint da testo a musica per creare un Task asincrono.",
    "url": "https://runapi.ai/it/docs/api/producer/text-to-music",
    "mainEntityOfPage": "https://runapi.ai/it/docs/api/producer/text-to-music"
  }
]
```
