The API doesn’t have the a quality in it.
And I can’t think of anything useful off the top of my head.
An alternative would be to consider the viewcount instead, as people wouldn’t watch a low quality stream.
Or you could require users install a twitch extension as the bitrate is provided in the onContext
Of course you’d need the extension to do something useful for the viewers rather than to farm the bitrate.
You can use getQualities with the embed API
But that would mean you’d have a page open, that would constantly be stream jumping to test the quality, Or use something like selenium. (and you’d have to wait for the advert to finish playing)
Another alternative would be to call the clips API to create a clip
Then use the undocumented Clips Endpoint to get the qualities that exist. But that’s a bit convoluted and open to failure.