4. Given the line segment $x+y=9(x \geqslant 0, y \geqslant 0)$ intersects the $y$-axis, the graph of the exponential function $y=a^{x}$, the graph of the logarithmic function $y=\log _{a} x$, and the $x$-axis at points $A$, $B$, $C$, and $D$ respectively, where $a>0, a \neq 1$. If the middle two points exactly trisect the line segment $A D$, then $a=$ $\qquad$ .
4. $\sqrt[3]{6}$ or $\sqrt[6]{3}$.

Obviously, $A(0,9), D(9,0)$.
When $A B=\frac{1}{3} A D$, point $B(3,6)$.
Thus, $6=a^{3} \Rightarrow a=\sqrt[3]{6}$.
When $A B=\frac{2}{3} A D$, point $B(6,3)$.
Thus, $3=a^{6} \Rightarrow a=\sqrt[6]{3}$.