I think it's possible to query size-on-disk, but that could be misleading if you happened upon a sparse file, or NTFS compressed file, or something else that's legitimately smaller on disk.
Instead, query the file attributes (the same as Hidden/ReadOnly) – if the file is not cached locally, it will have the Offline1 and RecallOnAccess attributes (bits 0x1000 and 0x400000 respectively).
Such files also seem to have the undocumented Unpinned attribute (0x100000), though I'm not sure if it's always all 3 attributes that are present or if there are situations.
Meanwhile, "Always keep on this device" corresponds to the Pinned attribute (0x80000). Files that are temporarily cached have neither of those attributes.
In PowerShell, (Get-Item $file).Attributes will have these flags.
If you're working with bare Cmd (no access to PowerShell), the attrib command will show "Recall on access" as the M flag and (I think) "Offline" as O. It also allows changing the pinned/unpinned flags, so you can actually mark files as "always keep" purely through the command line.
This is mostly specific to OneDrive. Last I checked, Dropbox worked quite differently.
1 The Offline attribute in Windows predates OneDrive by years – its origin was the "Hierarchical Storage Management" subsystem, which allowed unused files to be offloaded to tape or similar. Back then, data that was stored on the running system was "online" and data that was sitting in a cupboard was "offline". With cloud storage, the meanings have flipped.