Live2D Widget



Add Live2D widget to web page. Compatible with PJAX.

(Note: The character models above are for demonstration purposes only and are not included in this repository.)

You can also check out example web pages:


If you are a beginner or only need the basic functionality, you can simply add the following line of code to the head or body of your HTML page to load the widget:

<script src=""></script>

The placement of the code depends on how your website is built. For example, if you are using Hexo, you need to add the above code to the template file of your theme. The modification process is similar for pages generated using various template engines.
If your website uses PJAX, since the widget does not need to be refreshed on every page, make sure to place the script outside the PJAX refresh area.

However, we strongly recommend configuring the widget yourself to make it more suitable for your website!
If you are interested in customizing the widget, please refer to the detailed instructions below.


You can refer to the source code of autoload.js to see the available configuration options. autoload.js will automatically load three files: waifu.css, live2d.min.js, and waifu-tips.js. waifu-tips.js creates the initWidget function, which is the main function for loading the widget. The initWidget function accepts an object-type parameter as the configuration for the widget. The following are the available options:

Option Type Default Value Description
waifuPath string Path to the widget resources, can be modified
apiPath string API path, optional
cdnPath string CDN path, optional
tools string[] see autoload.js Buttons of the loaded tools, optional

Among them, the parameters apiPath and cdnPath only need to set one of them. apiPath is the URL of the backend API, which can be set up and modified by yourself (there are many things to modify, not discussed here). You can refer to live2d_api for more information. On the other hand, cdnPath is used to load resources through CDN services like jsDelivr, which provides better stability.


If the options provided in the “Configuration” section above are not enough to meet your needs, you can make modifications yourself. The directory structure of this repository is as follows:

By default, the CSS selector rules in waifu-tips.json are effective for the Hexo NexT theme, but you may need to modify or add new content to make it suitable for your own website.
Warning: The content in waifu-tips.json may not be suitable for all age groups or appropriate to access during work. Please ensure their suitability when using them.

To deploy the development testing environment of this project locally, you need to install Node.js and npm, then execute the following commands:

git clone
npm install
npm run build

If you have any questions, feel free to raise an issue. If you have any modification suggestions, welcome to submit a pull request.


After making modifications locally, you can deploy the modified project on a server or load it via a CDN for use on a webpage.

Using CDN

To customize the content, you can fork this repository and push the modified content to your own repository using git push. In this case, the usage method becomes:

<script src=""></script>

Replace username with your GitHub username. To ensure the content of the CDN is refreshed correctly, you need to create a new git tag and push it to the GitHub repository. Otherwise, @latest in the URL will still point to the previous version. Additionally, CDN itself has caching, so the changes may take some time to take effect. Relevant documentation:


Alternatively, you can directly host these files on your server instead of loading them via CDN.

Afterwards, the entire project can be accessed through your domain name. You can try opening the autoload.js and live2d.min.js files in your browser and confirm that their content is complete and correct.
If everything is normal, you can proceed to modify the constant live2d_path in autoload.js to the URL of the live2d-widget directory. For example, if you can access live2d.min.js through the following URL:

then modify the value of live2d_path to:

Make sure to include the trailing / in the path.
Once done, add the following code to the interface where you want to add the live2d-widget:

<script src=""></script>

This will load the widget.


BrowserStack Logo

Thanks to BrowserStack for providing the infrastructure that allows us to test in real browsers!

jsDelivr Logo

Thanks to jsDelivr for providing public CDN service.

The code is modified based on this blog post:

Thanks to Hitokoto for providing the sentence API.

When you click on the paper airplane button of the virtual assistant, a hidden surprise will appear. This feature is from WebsiteAsteroids.


For more information, you can refer to the following links:

Regarding the backend API models:

In addition to that, there are desktop versions available:

And also Wallpaper Engine:


Released under the GNU General Public License v3

This repository does not contain any models. The copyrights of all Live2D models, images, and motion data used for demonstration purposes belong to their respective original authors. They are provided for research and learning purposes only and should not be used for commercial purposes.

Official Live2D websites:

Live2D Cubism Core is provided under the Live2D Proprietary Software License.
Live2D Cubism Components are provided under the Live2D Open Software License.

The terms and conditions do prohibit modification, but obfuscating in live2d.min.js would not be considered illegal modification.

Update Log

On October 31, 2018, the original API provided by fghrsh was discontinued. Please update to the new address. Refer to the following article for more information:

Starting from January 1, 2020, this project no longer depends on jQuery.

Starting from November 1, 2022, this project no longer requires users to separately load Font Awesome.