iCloud Photos is a syncing service. Any photo you delete from a device where iCloud Photos is turned on will also be deleted from iCloud and from any other device connected to iCloud Photos. You can potentially reduce the storage space required on a device by turning on Optimize Storage. See: Set up and use iCloud Photos - Apple Support
Apple does not currently offer cloud-only storage for photos. If that is what you want or need, you may want to explore 3rd party options such as Google Photos or Dropbox.
See the following excerpt from the above link regarding optimized storage:
On your Mac:
- Open the Photos app and click Photos in the menu bar.
- Click Preferences.
- Go to the iCloud tab and choose a storage setting.
If you turn on Optimize Storage, iCloud Photos automatically manages the size of your library on your device. Your original photos and videos are stored in iCloud and space-saving versions are kept on your device. Your library is optimized only when you need space, starting with the photos and videos you access least. You can download the original photos and videos over Wi-Fi or cellular when you need them. You can use Optimize Storage on your iPhone, iPad, iPod touch, and Mac.