In the process of configuring a Secure Action Button to replicate a Spell Button's click actions, I discovered some data on the Pet Spell IDs. I don't know if this is already know, useful, or where to share the data. Current searches haven't found anything on this data already being known.
My mod was a spellbook rank filter for WoW Classic.
Pet Spell IDs returned from GetSpellBookItemInfo contains flags. If you strip off the 8 most significant bits, you are left with a SpellID that SecureActionButton can use with 'type = "spell"', inserted into the "spell" attribute.
Saying Bit 1 is the 1's digit...
Bit 25 (2^24 or 16,777,216) says the spell is a pet spell (0 = not pet spell, 1 = pet spell)
Bit 31 (2^30 or 1,073,741,824) is the autocast state (0 = autocast off, 1 = autocast on)
Bit 32 (2^31 or 2,147,483,648) says if the spell is castable (0 = passive, 1 = castable)
Basically, you need to do a bitwise and with 16,777,215, all bits from 0 to 23 are 1, to filter out these flag bits to make the pet spell ID cast with CastSpellByID.
I hope this is useful to someone, and I am not being unnecessarily redundant.