Hi Maxim!
If you intend to work in Santiago, the cheapest option is probably to live in Santiago itself. Depending on the neighbourhood you can find cheap places to live (and some expensive ones too), while still being connected to the city transport.
If you look for a city in the coast, both Viña del Mar and Valparaíso are great cities with their own vibe each. Valparaíso is the port so no beaches there, though connectivity to Viña del Mar is very speedy. However, from both of these cities you would have a 1:30hr bus ride to Santiago (departing every 15min), which might become quite tiring after a while if done everyday.
Hope this helps !