Solution (source code)

= Solution

The right-hand side depends on $x+y$, suggesting the substitution $u=x+y$. Then $y'=u'-1$, so the <ordinary differential equation> becomes
$$
u'=2-\frac4u=\frac{2(u-2)}u.
$$
The original equation is undefined at $u=0$. If $u\ne2$, this is a <separable differential equation>:
$$
\frac{u}{u-2}\,du=2\,dx,\qquad
u+2\ln|u-2|=2x+C.
$$
Substituting back gives the implicit family
$$
\boxed{y-x+2\ln|x+y-2|=C,\qquad x+y\ne0,2.}
$$
Differentiating the implicit equation gives $y'-1+2(1+y')/(x+y-2)=0$, or $(x+y)y'=x+y-4$, verifying it on its permitted intervals.

Division by $u-2$ excluded the constant solution $u=2$, which must be restored separately:
$$
\boxed{y=2-x.}
$$
It satisfies $y'=-1=(2-4)/2$. Together these give all local real solutions on intervals where $x+y\ne0$.