Skip to content

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.

Error output
API Error: 400 bad request: Authorization header is badly formatted

Using 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).

  1. In cc-switch, go to 设置 -> 路由 -> 本地路由 (Settings > Routing > Local routing) and turn local routing on. GitHub Copilot depends on it to work.

  2. 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.

  3. 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).

ToolClaude Code
Version3.12.3 - 3.14.1 (affected range)
PlatformsWindowsmacOS
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.

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.