I understand your concerns.
Luckily, there is a "standard" for streaming compression libraries (zlib, bz2, lzo, snappy, lzma).
They all follow same api and compression level scale of 0-9, the only exclusion I am ware of is liblzma which also allows setting "extra" bit to allow more lengthy but potentially more compact output.
Above means we can use same scheme I've proposed, libs not supporting "extra" bit will just use modulo10 of provided compression level.