Step 1: Use the given general solution.
Given,
\[
y=\tan x-1+Ce^{-\tan x}
\]
Also,
\[
y\left(\frac{\pi}{4}\right)=1
\]
Substitute
\[
x=\frac{\pi}{4}
\]
in the solution.
Step 2: Evaluate trigonometric values.
Since,
\[
\tan\frac{\pi}{4}=1
\]
we get
\[
1=1-1+Ce^{-1}
\]
\[
1=\frac{C}{e}
\]
Step 3: Solve for \(C\).
Multiplying both sides by \(e\),
\[
C=e
\]
Step 4: Final conclusion.
Therefore,
\[
\boxed{e}
\]