After about every 500 rounds or so - unless it is one of my .22's. Those typically go thousands before a good cleaning. Personally, I think more damage is done to firearms from over-cleaning than from not being clean enough.
It's another story altogether for my black powder firearms. Those obviously get cleaned after every session regardless of the amount of times they have been shot. But this is because I HAVE to do those
Cleaning guns is not one of my favorite pastimes ......
I have gone both routes with pistols. When I first started shooting, I cleaned my pistol after every use. After a while, I became lax and performed a de facto torture test on a Glock. I had almost 3,000 rounds through it before I cleaned it.
The Glock has a lot of play (much looser than the Walther) so the grime only served to tighten everything up and made the weapon more accurate. -However, after a cleaning up the mess, I resolved never to do that again. Just because the gun can take it doesn't mean it should be neglected.
The Walther P99's design, construction, and the materials used in its assembly combine to make a great pistol. It can be put away dirty, but I think it's a better practice to clean it after range use.
I clean after every shooting session, i.e. field stripping and cleaning barrel, slide and frame (inside and outside). About four times a year I clean the recoil spring guide rod and the inside of the frame with compressed air and lately (after four years) I completely stripped the gun (including trigger and striker assemblies and the fire control module) for a profound cleaning. I would recommend it to everybody.
After every range session the pistol gets field stripped and the barrel and breach patched with solvent. The rest of the gun wiped down and put back together with a drop or two of lube on the sliding surfaces. Once or twice a year I'll do a thorough cleaning.