6. $\odot O$ has a radius of $r$, and its circumscribed right trapezoid $A B C D$ has two bases $A B=a, D C=b$. Then the relationship between $r, a, b$ is ( ).
(A) $r=|a-b|$
(B) $r=\frac{1}{2} \sqrt{\left|a^{2}-b^{2}\right|}$
(C) $r=\frac{1}{2} \sqrt{a b}$
(D) $\frac{1}{r}=\frac{1}{a}+\frac{1}{b}$
6. D.

As shown in Figure 4, draw the altitude $C E$. Then
$$
\begin{array}{l}
C E=2 r, \\
E B=|a-b|, \\
B C=a+b-2 r . \\
\text { By }(a+b-2 r)^{2} \\
=B C^{2}=C E^{2}+E B^{2}=(2 r)^{2}+(a-b)^{2},
\end{array}
$$

we get $r(a+b)=a b$.
Thus, $\frac{1}{r}=\frac{a+b}{a b}=\frac{1}{a}+\frac{1}{b}$.