Claude Desktop: fix Cowork and Code gateway failures
Troubleshoot Claude Desktop Cowork and Code mode after connecting a BetterToken Gateway by checking mapping, routing, certificates, settings, and restarts.
After you configure the BetterToken Gateway in Claude Desktop, the following symptoms usually do not mean the API Key itself is invalid:
- Cowork mode does not work
- Code mode shows
Claude Code process exited with code 1 - The same API Key works in Claude Code CLI from a terminal
If you have not configured the Gateway yet, start with Use BetterToken API in Claude Desktop.
Fix Cowork mode first
Claude Desktop supports only Claude models. This is a Claude Desktop client limitation.
Check that the API Key is copied correctly and has not expired. Use x-api-key for this Gateway configuration, save, and restart Claude Desktop.
Use the Claude Desktop setup guide to configure Gateway, Base URL https://bettertoken.ai, your BetterToken API Key, and Gateway auth scheme x-api-key. Save with Apply locally, then fully restart Claude Desktop.
Then fix Code mode exit errors
If Cowork works but Code mode, the </> tab, still shows Claude Code process exited with code 1, check whether Claude Desktop is still using an older bundled Claude Code version.
Root cause: Claude Desktop may be downloading a newer Claude Code version in the background. Before the download finishes, Code mode can fall back to an older installed Claude Code version. That older version may not be compatible with third-party Gateway usage in Code mode, so the process exits immediately.
How to fix it:
Wait for the newer Claude Code version to finish downloading
Keep Claude Desktop open for a while so the background Claude Code update can complete.
Fully quit Claude Desktop
Use Cmd+Q to fully quit the app. Do not only close the window.
Reopen and start a new Code session
Open Claude Desktop again, then go to Code mode and start a new session.
Quick reference
| Symptom | Common root cause | Fix |
|---|---|---|
| Cowork | Gateway auth scheme | Check that the API Key is copied correctly and has not expired. Use x-api-key for this Gateway configuration, save, and restart Claude Desktop. |
Code mode shows Claude Code process exited with code 1 | Claude Desktop falls back to an older Claude Code version | Wait for the newer version to finish downloading, fully quit with Cmd+Q, then reopen |

