Pull up on NPN transistor (during microcontroller power up)
You must add a resistor between the GPIO output and the transistor’s base. If the transistor’s base was driven at 3.3V, it would drain a few amperes and either the transistor or the MCU would blow. If it did not blow, it probably means that something is limiting the current on the GPIO output, but I would not recommend depending on this.

If your MCU needs it, you certainly can add a pull-up resistor to GPIO2. As long as its value is high enough (10k is standard for me), the MCU can easily drive the pin low when requested so.

The schematic would be something like this:







simulate this circuit &ndash; Schematic created using CircuitLab

Edit: R2 should be much lower than R1, but still high, so I fixed the values and replaces the single transistor with a darlington-like structure to have a high-enough gain to properly drive the relay.







simulate this circuit