I got an idea of using a ATtiny85 and an optocoupler to control my raspberry pi's power supply. The optocoupler is the L1513. Would this be possible?
I assume you intend to use an optocoupler to turn on the power to a RPi?
Assuming this is the case I don't think this would be the best way to accomplish this. Optoisolators are commonly used when there are different voltage levels on either side and/or the signals on either end may vary. This will not be the case for you. Your Atiny will be operating on 5V or 3.3V and the input power for the Rpi will be 5V. You may want to simply use a transistor, MOSFET or transistor operated relay board.
Learn All About optocouplers here: