We consider the semilinear wave equation g u + au 4 = 0, a = 0, on a Lorentzian manifold (M, g) with timelike boundary. We show that from the knowledge of the Dirichlet-to-Neumann map one can recover the metric g and the coefficient a up to natural obstructions. Our proof rests on the analysis of the interaction of distorted plane waves together with a scattering control argument, as well as Gaussian beam solutions.We only consider boundary sources f with supp f ⊂ (0, T ) × ∂N and introduce the Dirichlet-to-Neumann (DN) map Λ g,a (measured in (0, T ) × ∂N ) defined aswhere u is the solution of (1.2). The well-posedness of the initial boundary value problem (1.2) with small Dirichlet data f ∈ C m , m ≥ 6, can be established as in [23]. Thus Λ g,a f is well-defined for such f . We will study the inverse problem or recovering the Lorentzian metric g and the nonlinear coefficient a from Λ g,a . We choose to consider the semilinear equation with a quartic nonlinear term because it requires the least amount of technicalities in the analysis of nonlinear interactions