Camera for short distance pictures

I’m working on a project that requires a mini camera for very close-up photography (1-2 cm with little or no magnification; the subject being photographed fits within a circle about 3.5 cm in diameter; depth of field required - about 1 cm). I want to take pictures of medical pills for identification by an AI model. I’d like the camera to work with a Raspberry Pi (but it’s not essential). Can anyone help me choose a camera - lens set?

Have you seen this?
Microscope stand with 0.12-1.8x lens

Thanks so much for the suggestion. Conceptually, it’s exactly what I’m looking for. However, the dimensions are unacceptable for my project (lens length).

I am not sure if your requirements can be met by physics. Close-up photography with a deep depth of field isn’t possible. I would also be worried by distortion.

Have you researched ESP32 cameras? (e.g. see Best ESP32 Camera Module - OV2640, OV5640, OV3660 and OV7670 Compared). I don’t know if the linked survey covers all versions, but there are many for various needs. Maybe something suitable for close-ups is also available.

Adding a second device adds complexity, but you should be able to download the images to the Pi without problems. There are many projects that use the ESP32-cams and expose the images via a webserver.