There is an unsupported API you can use for this; Though keep in mind that it’s unsupported, undocumented, and can go away or change at any time.
https://tmi.twitch.tv/hosts?include_logins=1&host=51684790
Hosting example response
{
"hosts": [
{
"host_id": 51684790,
"target_id": 88560344,
"host_login": "modesttim",
"target_login": "weetbot",
"host_display_name": "ModestTim",
"target_display_name": "WeetBot"
}
]
}
51684790 is ModestTim which is the channel we want to see if is hosting and 88560344 is WeetBot aka the target which is who we are hosting.
Not hosting example
{
"hosts": [
{
"host_id": 51684790,
"host_login": "modesttim",
"host_display_name": "ModestTim"
}
]
}