---
title: Producer Text-to-Music
url: https://runapi.ai/docs/api/producer/text-to-music.md
canonical: https://runapi.ai/docs/api/producer/text-to-music
locale: en
---

# Producer Text-to-Music

## Overview

Use the text to music endpoint with a supported model. Use the returned Task ID to retrieve its state, or provide callback_url for the deliveries documented below.

### Quick start

1. Create an API key and set it as RUNAPI_API_KEY.
2. Choose a supported model and send a POST request whose body matches that model's schema.
3. Store the returned task ID, then poll until a terminal state or handle the callbacks documented below.

## Endpoint

POST /api/v1/producer/text_to_music

Base URL: https://runapi.ai

API version: v1

Authentication: Authorization: Bearer YOUR_API_TOKEN

## Supported models

Open a model page for current pricing, rate limits, and commercial-usage details.

- [fuzz-0.8](/models/producer/fuzz-0.8)
- [fuzz-1.0](/models/producer/fuzz-1.0)
- [fuzz-1.0-pro](/models/producer/fuzz-1.0-pro)
- [fuzz-1.1](/models/producer/fuzz-1.1)
- [fuzz-1.1-pro](/models/producer/fuzz-1.1-pro)
- [fuzz-2.0](/models/producer/fuzz-2.0)
- [fuzz-2.0-pro](/models/producer/fuzz-2.0-pro)
- [fuzz-2.0-raw](/models/producer/fuzz-2.0-raw)

## Request schema

Fields and allowed values depend on the selected model. When supplied, callback_url receives the Task deliveries documented below.

### fuzz-0.8

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.0

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.0-pro

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.1

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-1.1-pro

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-2.0

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-2.0-pro

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

### fuzz-2.0-raw

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "lyrics": {
    "description": "Exact lyrics to sing.",
    "type": "string"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Music style and production brief.",
    "length": true,
    "max": 200,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "title": {
    "description": "Music title.",
    "type": "string"
  },
  "vocal_mode": {
    "description": "Vocal generation mode.",
    "enum": [
      "exact_lyrics",
      "instrumental"
    ],
    "required": true,
    "type": "string"
  }
}
```

#### Conditional rules

These requirements apply when all listed conditions match.

- **When**: `vocal_mode` = `exact_lyrics`; **Required**: `lyrics`
- **When**: `vocal_mode` = `instrumental`; **Not accepted**: `lyrics`

## Create acceptance

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

### Response schema

```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
}
```

### Response example

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

## Polling processing

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

### Response schema

```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
}
```

### Response example

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

## Polling completed

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

### Response schema

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string"
          },
          "duration_seconds": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string"
          },
          "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
}
```

### Response example

```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 failed

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

### Response schema

```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
}
```

### Response example

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

## Customer callback: completed

HTTP 200 - POST callback_url

### Response schema

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string"
          },
          "duration_seconds": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string"
          },
          "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
}
```

### Response example

```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"
}
```

## Customer callback: failed

HTTP 200 - POST callback_url

### Response schema

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "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
}
```

### Response example

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

## Errors

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

This response has no body.

## Errors

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

This response has no body.

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "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",
    "message": "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"
  }
}
```

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "insufficient_balance",
    "message": "Insufficient balance"
  }
}
```

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "api_token_credit_limit_exceeded",
    "message": "API key credit limit exceeded"
  }
}
```

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

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

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit reached. Please retry later."
  }
}
```

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

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

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": {
    "code": "timeout_error",
    "message": "The request timed out"
  }
}
```

## Errors

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

### Response schema

```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": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "not_found",
    "message": "Task with id 'tsk_reference_demo' not found"
  }
}
```

## Generated Code Samples

Use cURL directly, or install an SDK for your language. Each sample submits the validated request shown in this reference.

### 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

#### Install

```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

#### Install

```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

#### Install

```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

#### Install

```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

#### Install

```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

#### Install

```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."
]);
```

## Related Guides

- [Authentication](/docs/guides/authentication)
- [Quickstart](/docs/guides/task-api/quickstart)
