6. Given the sets $A=\{(x, y) \mid | x|+| y |=a, a>0\}, B=\{(x, y) \mid | x y|+1=| x|+| y |\}$. If $A \cap B$ is the set of vertices of a regular octagon on the plane, then the value of $a$ is $\qquad$
Solve:
$$
|x y|+1=|x|+|y| \Rightarrow(|x|-1)(|y|-1)=0,
$$

As shown in the figure, when the side length of the regular octagon is 2, $B C=\sqrt{2}$
$$
\Rightarrow C(1+\sqrt{2}, 1) \Rightarrow a=2+\sqrt{2} \text {; }
$$

When the regular octagon is the shaded area in the figure,
$$
A(a-1,1) \Rightarrow A B=2-a
$$
$\Rightarrow 2-a=\sqrt{2}(a-1) \Rightarrow a=\sqrt{2}$. In summary, the value of $a$ is $2+\sqrt{2}$ or $a=\sqrt{2}$.