At the very beginning of Landau and Lifshitz Mechanics they derive the form of the Lagrangian for a free particle in Newtonian mechanics.
I want to see how to do the analogous derivation in special relativity.
For Newtonian mechanics they say that, first, the Lagrangian $L$ can only be a function of $v^2$ and not $\vec{x}$ or $\vec{v}$ since there are no special locations or directions. Then they look at the Lagrangian in another inertial frame moving at relative velocity $\vec{\epsilon}$ and say that it must differ from the original by a total time derivative in order to keep the equations of motion the same.
The square of the velocity in the new frame is $$ {v'}^2 = v^2 + 2 \vec{v}\cdot\vec{\epsilon} + \mathcal{O}(\epsilon^2), $$ so the Lagrangian in this frame is $$ L({v'}^2)=L(v^2)+\frac{\partial L}{\partial v^2} 2 \vec{v}\cdot\vec{\epsilon}. $$ For the last term to be a total time derivative it has to be a linear function of the velocity, i.e. $\partial L/\partial v^2$ is constant. And then you get $L \propto v^2$.
$$ ---$$
I tried doing the same thing for special relativity, the only change being the different formula for the velocity in the moving inertial frame. I find $$ \frac{{v'}^2}{c^2} = 1 - \left(1-\frac{v^2}{c^2}\right)\left(1-\frac{\epsilon^2}{c^2}\right)\left(1-\frac{v_x \epsilon}{c^2}\right)^{-2}, $$ for a boost by velocity $\epsilon$ along the $x$-axis (can get this quickly writing the invariant interval $c^2 dt^2 - dx^2 = c^2 dt'^2 - dx'^2$ and using the Lorentz transformation for the time coordinate to get $dt'/dt$).
For small $\epsilon$ I get $$ {v'}^2 = v^2 - 2 \left(1-\frac{v^2}{c^2}\right) v_x \epsilon, $$ so $$ L({v'}^2)=L(v^2)-2 \left(1-\frac{v^2}{c^2}\right) v_x \epsilon \frac{\partial L}{\partial v^2} . $$
I think the argument that the last term be a total time derivative again means that the last term must be linear in the velocity. Therefore, $$ \frac{\partial L}{\partial v^2} \propto \left(1-\frac{v^2}{c^2}\right)^{-1}. $$
But integrating this gives $$L \propto \log\left(1-\frac{v^2}{c^2}\right),$$
not the right answer, which is $L\propto \sqrt{1-\frac{v^2}{c^2}}$.
Where am I going wrong?