# Configure the OTA URL

URL: https://docs.assistantcore.com/en/devices/configure-ota-url

Point Xiaozhi-based ESP32 firmware at Assistant Core, from the device's Wi-Fi setup page or by building the firmware yourself.

Assistant Core works with the open-source [Xiaozhi ESP32](https://github.com/78/xiaozhi-esp32) firmware and firmware based on it. To use such firmware with Assistant Core, set its **OTA URL** to:

```text
https://api.assistantcore.com/voice/ota
```

The device calls this URL every time it connects to Wi-Fi to get the server time, its activation code, its connection details, and firmware updates. If the URL is wrong, the device never shows an activation code and cannot start a conversation.

<Callout type="info">
Firmware you install from [Flash firmware](/en/devices/flash-firmware) already uses this URL. You only need this page for third-party or self-built Xiaozhi firmware.
</Callout>

## Option 1: set it on the device [#option-1-set-it-on-the-device]

Use this when the firmware's Wi-Fi setup page shows an OTA field. Stock Xiaozhi firmware does.

1. Put the device in Wi-Fi setup mode: a device with no saved Wi-Fi starts it automatically; otherwise restart the device and press **BOOT** while it is starting up.
2. Join the device's setup hotspot (for stock Xiaozhi firmware it is named `Xiaozhi-XXXX`) and open `http://192.168.4.1` if the page does not open by itself.
3. Open the **Advanced** tab, enter the URL above in **Custom OTA URL**, and click **Save Config**.
4. On the **Wi-Fi** tab, select your 2.4 GHz network, enter the password, and click **Connect Now**.

The setting is stored on the device and survives restarts. Erasing the flash removes it.

## Option 2: build the firmware with the URL [#option-2-build-the-firmware-with-the-url]

### Before you start [#before-you-start]

- **ESP-IDF v6.0.1 or later** (v6.1 recommended). Current Xiaozhi releases do not build with ESP-IDF 5.x. See the [ESP-IDF getting started guide](https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/get-started/index.html).
- An ESP32-S3 board connected with a USB data cable.

### Steps [#steps]

1. Get the source and open the folder:

   ```bash
   git clone https://github.com/78/xiaozhi-esp32.git
   cd xiaozhi-esp32
   ```

2. Load the ESP-IDF environment in your shell (for example `. $HOME/esp/esp-idf/export.sh`), then set the chip:

   ```bash
   idf.py set-target esp32s3
   ```

3. Open the configuration menu:

   ```bash
   idf.py menuconfig
   ```

4. Go to **Xiaozhi Assistant**, select **Default OTA URL**, press `Enter`, and type the URL above. In the same menu, check that **Board Type** matches your hardware. Press `S` to save and `Q` to quit.
5. Build, flash, and open the serial monitor:

   ```bash
   idf.py build
   idf.py flash monitor
   ```

   Press `Ctrl+]` to leave the monitor.

If the serial port is not detected, put the board in download mode: hold **BOOT**, press and release **RST**, release **BOOT**, and flash again.

## Check that it worked [#check-that-it-worked]

After the device joins Wi-Fi, it shows a 6-digit activation code and reads it aloud. In the serial monitor you can also see the request to the OTA URL. Continue with [Register a device](/en/devices/register-device).

## Troubleshooting [#troubleshooting]

<Accordions>
<Accordion title="The device shows a network or server error instead of a code">
Check the URL for typos: it must start with `https://` and end with `/voice/ota`. Then check that the Wi-Fi network can reach the internet.
</Accordion>

<Accordion title="The build fails right away">
Check your ESP-IDF version with `idf.py --version`. Xiaozhi needs v6.0.1 or later.
</Accordion>
</Accordions>