[guided]Assume that $\operatorname{epi} f$ is convex. We want to recover the convexity inequality for $f$, so fix arbitrary points $x,y \in \mathbb{R}^n$ and a weight $t \in [0,1]$.
The desired inequality is
\begin{align*}
f(tx+(1-t)y) \le t f(x) + (1-t) f(y).
\end{align*}
When $t=0$, this reads $f(y) \le f(y)$, and when $t=1$, it reads $f(x) \le f(x)$. Hence the endpoint cases hold. We now assume $0<t<1$.
If $f(x)=+\infty$ or $f(y)=+\infty$, then because $t>0$ and $1-t>0$, the extended-real expression $t f(x)+(1-t)f(y)$ is $+\infty$. The inequality then holds automatically in $(-\infty,+\infty]$. Thus the only substantive case is
\begin{align*}
f(x), f(y) \in \mathbb{R}.
\end{align*}
Why do we use heights slightly above $f(x)$ and $f(y)$ rather than the heights $f(x)$ and $f(y)$ themselves? The epigraph is a subset of $\mathbb{R}^n \times \mathbb{R}$, so its second coordinate must be real. In the present finite-valued case the exact heights are real, but using a positive excess $\varepsilon$ also makes the limiting argument explicit and matches the extended-real formulation.
Let $\varepsilon>0$. Define
\begin{align*}
r_\varepsilon := f(x)+\varepsilon
\end{align*}
and
\begin{align*}
s_\varepsilon := f(y)+\varepsilon.
\end{align*}
These are [real numbers](/page/Real%20Numbers), and they lie above the corresponding function values. Hence
\begin{align*}
(x,r_\varepsilon),(y,s_\varepsilon) \in \operatorname{epi} f.
\end{align*}
Since $\operatorname{epi} f$ is convex, the convex combination of these two epigraph points also belongs to $\operatorname{epi} f$:
\begin{align*}
t(x,r_\varepsilon)+(1-t)(y,s_\varepsilon) \in \operatorname{epi} f.
\end{align*}
Computing this convex combination in $\mathbb{R}^n \times \mathbb{R}$ gives
\begin{align*}
t(x,r_\varepsilon)+(1-t)(y,s_\varepsilon) = (tx+(1-t)y, tr_\varepsilon+(1-t)s_\varepsilon).
\end{align*}
Membership in the epigraph now translates back into the height inequality
\begin{align*}
f(tx+(1-t)y) \le tr_\varepsilon+(1-t)s_\varepsilon.
\end{align*}
Substitute the definitions of $r_\varepsilon$ and $s_\varepsilon$:
\begin{align*}
f(tx+(1-t)y) \le t(f(x)+\varepsilon)+(1-t)(f(y)+\varepsilon).
\end{align*}
Since $t+(1-t)=1$, this becomes
\begin{align*}
f(tx+(1-t)y) \le t f(x)+(1-t)f(y)+\varepsilon.
\end{align*}
This inequality holds for every $\varepsilon>0$. Therefore the left-hand side is bounded above by every number strictly larger than $t f(x)+(1-t)f(y)$. By the order completeness of $\mathbb{R}$,
\begin{align*}
f(tx+(1-t)y) \le t f(x)+(1-t)f(y).
\end{align*}
Since $x$, $y$, and $t$ were arbitrary, $f$ is convex.[/guided]