Dynamic head tag is possible?

I need to integrate a third party service.

This service requires we place the following in the Head tag of the page.

<script src="URL"></script> <script> const weavy = new Weavy(); weavy.url = "URL"; weavy.tokenFactory = async () => "TOKEN"; </script>

When I place this script with a static TOKEN, it works fine along the HTML code. But how do I make the TOKEN dynamic?

This is solved. ChatGPT gave me Javascript I could use.