These are questions for Legal Aid, I sent you the address and phone number earlier today.
I don't believe the city will evict you, rather it will fine your landlord for renting an illegal space. The Landlord will most likely want you to move to avoid paying fines. As for time frame for you to move - Legal Aid will have the answers regarding your rights and the Landlord's responsibility to you. In the meantime, get yourself a smoke detector. .
Even if the landlord is willing to make the necessary changes to make the space legal, it will take time and money. Depending on exterior access to the window, the cost to enlarge will most likely be $1000 - $3000
I don't know the regulations pertaining to Portland and I'm not a lawyer, so take with a grain of salt what follows. Still . . .
1) It's possible for the city to declare the apartment you're living in to be in non-compliance with its regulations. In a case like that, they'd typically go after the owner, requiring the owner to cease renting the noncompliant unit. So, while they wouldn't be evicting you, the end result would be the same. You'd have to move. It doesn't matter whether you pay your own electric, phone, cable, etc. The question is whether the apartment can legally be rented as a separate room. And I don't know the answer to that.
2) It's probably legal for a landlord to charge rent for an illegal unit. And while ignorance of the law is no excuse, maybe he thought the unit was legal. And you apparently thought it was, too. And, after all, it's his property. More to the point, if you find out it's a noncompliant unit--no, you can't stay there and not pay rent. If I were the owner and the city told me that I couldn't rent the basement apartment, I'd get you out as quickly as the law allowed. After all, he'd be continuing to break the law if he permitted you to stay.
You're in a potentially difficult spot. If you are in a noncompliant unit, then you probably should move. Certainly if the city finds out, you may have to move. You might be able to buy a little bit of time, but likely that's a few days or a week or two . . . not months. The landlord might be given the option by the city to bring the unit into compliance--if that's possible. But then the question is whether he's able to do so. Smoke detectors are easy. Providing a new exit . . . not so much, especially if the window measurements don't qualify as an exit.
Again, as Diane suggested, check with Legal Aid.