Authorization header is badly formatted - Claude Code
Quick fix
Turn "local routing" on in cc-switch and set the API format to native, resolving the 400 auth header error connecting GitHub Copilot to Claude Code.
Symptom
Section titled “Symptom”API Error: 400 bad request: Authorization header is badly formattedUsing cc-switch to make GitHub Copilot a Claude Code provider, without local routing or the API format configured correctly, cc-switch cannot convert and inject the auth header properly, so the GitHub Copilot API rejects the request with a 400. In early versions such as 3.12.3 there was also a header injection bug at the code level (the log may show MissingJsonContentType alongside), fixed on a later main branch (PR #1894).
In cc-switch, go to 设置 -> 路由 -> 本地路由 (Settings > Routing > Local routing) and turn local routing on. GitHub Copilot depends on it to work.
Make sure the GitHub Copilot provider API format is set to native, leave the auth field at its default, and make sure your network proxy (VPN) is on.
If those settings do not help, your version has the known bug. Update to the latest version, or clone from main and build locally (you need the PR #1894 fix).
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why can I not find the GitHub Copilot routing option on the main screen?
- The GitHub Copilot routing option is not shown on the main screen by default — turn it on under 设置 -> 路由 -> 本地路由 (Settings > Routing > Local routing).
- It still errors after re-cloning and building. What now?
- The fix in early versions such as 3.12.3 may not cover everything. Wait for the relevant PR (#1894) to merge and try again, or check your VPN is on and try another model.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.