4. Let the function be
$$
f(x)=k\left(x^{2}-x+1\right)-x^{3}(1-x)^{3} \text {. }
$$

If for any $x \in[0,1]$, we have $f(x) \geqslant 0$, then the minimum value of $k$ is $\qquad$
4. $\frac{1}{48}$.

For any $x \in [0,1]$, we have
$$
k \geqslant \frac{x^{3}(1-x)^{3}}{x^{2}-x+1} \text {. }
$$

Since $x^{2}-x+1=\left(x-\frac{1}{2}\right)^{2}+\frac{3}{4} \geqslant \frac{3}{4}$, when $x=\frac{1}{2}$,
$$
\left(x^{2}-x+1\right)_{\min }=\frac{3}{4} \text {. }
$$

Notice that, $\sqrt{x(1-x)} \leqslant \frac{1}{2}$.
Therefore, when $x=\frac{1}{2}$, $\left(x^{3}(1-x)^{3}\right)_{\text {max }}=\left(\frac{1}{2}\right)^{6}$.
In summary, the minimum value of $k$ is $\frac{1}{48}$.