If you are using REST calls on your JS code, you can point to a endpoint like that: https://generativelanguage.googleapis.com/v1beta/$modelname:generateContent?key=$GOOGLE_API_KEY
https://generativelanguage.googleapis.com/v1beta/$modelname:generateContent?key=$GOOGLE_API_KEY
You can find more details at the Fine-tuning tutorial page.