---
title: DreamBooth API Usage Guide
slug: 6DCWoM_fbbp1XuSHH8vVc
createdAt: Thu Jul 18 2024 06:12:37 GMT+0000 (Coordinated Universal Time)
updatedAt: Thu Jul 18 2024 13:40:04 GMT+0000 (Coordinated Universal Time)
---

# DreamBooth API Usage Guide

## Introduction

This document will guide developers on how to use the aonweb library to call the DreamBooth API, which is used for voice cloning and text-to-speech conversion.

## Prerequisites

- Node.js environment
- `aonweb` library installed
- Valid Aonet APPID

## Basic Usage

### 1. Import Required Modules

```js
import { AI, AIOptions } from 'aonweb';
```

### 2. Initialize AI Instance

```js
const ai_options = new AIOptions({
    appId: 'your_app_id_here',
    dev_mode: true
});

const aonweb = new AI(ai_options);
```

### 3. Prepare Input Data Example

```js
const data = {
   input:{
    "seed": 1337,
    "adam_beta1": 0.9,
    "adam_beta2": 0.999,
    "resolution": 512,
    "adam_epsilon": 1e-8,
    "class_prompt": "a cat",
    "lr_scheduler": "constant",
    "instance_data": "https://replicate.delivery/pbxt/HlRmIY3SePK6D8ZgnTvgymRWRSFqJlrDrfxJjA6QAazg1wVl/data.zip",
    "learning_rate": 0.000001,
    "max_grad_norm": 1,
    "n_save_sample": 4,
    "use_8bit_adam": false,
    "instance_prompt": "a cjw cat",
    "max_train_steps": 1000,
    "num_class_images": 100,
    "num_train_epochs": 1,
    "save_infer_steps": 50,
    "train_batch_size": 1,
    "adam_weight_decay": 0.01,
    "prior_loss_weight": 1,
    "sample_batch_size": 4,
    "train_text_encoder": true,
    "save_guidance_scale": 7.5,
    "gradient_checkpointing": false,
    "with_prior_preservation": true,
    "gradient_accumulation_steps": 1
  }
};
```
### 4. Call the AI Model

```js
const price = 8; // Cost of the AI call
try {
    const response = await aonweb.prediction("/predictions/ai/dreambooth", data, price);
    // Handle response
    console.log("DreamBooth result:", response);
} catch (error) {
    // Error handling
    console.error("Error generating :", error);
}
```

### Parameter Description

- 

### Notes

- Ensure that the provided audio URL is publicly accessible and of good quality to achieve the best cloning effect.
- The API may take some time to process the input and generate the result, consider implementing appropriate wait or loading states.
- Handle possible errors, such as network issues, invalid input, or API limitations.
- Adhere to the terms of use and privacy regulations, especially when handling voice samples of others.

### Example Response

The API response will contain the URL of the generated cloned voice or other relevant information. Parse and use the response data according to the actual API documentation.