4. 14 .

As shown in Figure 3, extend $A I$ to intersect $B C$ at point $D$, and the circumcircle of $\triangle A B C$ at point $E$. Connect $B E$.

Since $O$ is the center of the circle and $O I \perp A I$, by the perpendicular chord theorem, we have
$$
A I=I E .
$$

By the properties of the incenter, we get $E B=E I$.
Thus, $E B=E I=A I \Rightarrow A E=2 E B$.
Since $A E$ bisects $\angle B A C$, we have
$$
\angle B A E=\angle C A E=\angle E B D \text {. }
$$

Also, $\angle A E B=\angle B E D$, so
$$
\triangle B E D \backsim \triangle A E B \text {. }
$$

Therefore, $\frac{B E}{A E}=\frac{E D}{B E}$.
Thus, $E D=\frac{B E^{2}}{A E}=\frac{B E}{2} \Rightarrow E D=\frac{I E}{2}$
$$
\Rightarrow A I=E I=2 D I \text {. }
$$

Connect $B I$ and $C I$. Then $B I$ bisects $\angle A B D$, and $C I$ bisects $\angle A C D$.
By the Angle Bisector Theorem of a triangle, we have
$$
\frac{A B}{B D}=\frac{A I}{D I}=2, \frac{A C}{C D}=\frac{A I}{D I}=2 \text {. }
$$

Thus, $B D=\frac{A B}{2}, C D=\frac{A C}{2}$.
Therefore, $B C=B D+C D=\frac{A B+A C}{2}=14$.
4. As shown in Figure 1, the circumcenter of $\triangle A B C$ is $O$, the incenter is $I, O I \perp A I, A B=10$, $A C=18$. Then the length of $B C$ is $\qquad$ .