I have a domain like 0.ape.stream.local
The 0 increments up to an infinite number.
How do I go about making any number (*.ape.stream.local) go to same place?
You pretty much have the answer in your post. You are looking to setup a "wildcard" which will point any (*) subdomain to the same location.
You will need to set this up on the DNS level along with the web server level.
For DNS simply point *.ape.stream.local -> webserverip or cluster ip
At the Webserver depending on which flavor you are using (Apache or IIS) you can either setup a wildcard subdomain to serve the traffic or you can setup individual configurations for each subdomain depending on your needs.