apikey无权限或失效 - Claude Code Model List Retrieval
Quick fix
Use curl to verify /v1/models access. Remove spaces or a Bearer prefix from the Key; if the endpoint is unavailable, enter the model name manually.
Symptom
Section titled “Symptom”apikey无权限或失效apikey has no permission or is invalid
CC Switch requests `{Base URL}/v1/models` using the OpenAI-compatible protocol and sends `Authorization: Bearer <API Key>`. If the endpoint returns 401/403, the UI displays “API Key 无效或无权限”. This does not necessarily mean the Key has expired; the provider may not expose the model-list endpoint, or the Key may only have access to the chat endpoint. Failures have also been reported for 火山 agent-plan, 火山 coding-plan, and 智谱 coding-plan, but these issues provide no confirmed provider-side solution.
This issue group also contains several variants: the maintainer said that “请先填写 API Key” in v3.14.1 was fixed in v3.15.0, but users still reported retrieval failures from v3.16.1 through v3.16.5. One Windows user also reported that curl succeeded while CC Switch failed to connect. Therefore, upgrading only resolves some known problems and does not prove that every model-list failure has been fixed.
Check the API Key input. Enter only the raw Key, removing leading or trailing spaces, line breaks, and any accidentally pasted `Bearer ` prefix.
Request the provider's model-list endpoint with the same Key, for example by running `curl -H "Authorization: Bearer YOUR_KEY" https://windhub.cc/v1/models`.
If curl returns 401/403, ask the provider whether the Key has access to `/v1/models` and whether the endpoint is available.
If the chat endpoint works but the model-list endpoint is unavailable, manually enter the model name to continue.
If “请先填写 API Key” appears in v3.14.1, upgrade to v3.15.0, where the maintainer marked the issue as fixed, or to a newer version.
If curl returns 200 but CC Switch still fails, submit the CC Switch version, operating system, Base URL, and relevant logs. Do not submit the API Key.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 5 real issues
- Is this a bug or another issue?
- There may be different causes. The maintainer confirmed that “请先填写 API Key” in v3.14.1 was fixed in v3.15.0. A 401/403 may instead mean that the Key cannot access `/v1/models`; it does not necessarily mean the API Key has expired.
- Why can someone else retrieve the model list with the same Key while I get a permission or invalid-Key error?
- First check whether the Key contains spaces, line breaks, or a `Bearer ` prefix, then request `/v1/models` directly with the same Key. If curl succeeds but CC Switch fails, continue troubleshooting with the version, operating system, Base URL, and logs.
- Can I still use it if the model list cannot be retrieved?
- If the chat endpoint works and only the model-list endpoint is unavailable or unauthorized, manually enter the model name to continue.
- What should I do if retrieval fails with 火山 agent-plan, 火山 coding-plan, or 智谱 coding-plan?
- The input issues report failures with these services but provide no confirmed fix. First verify the corresponding Base URL `/v1/models` endpoint and the Key's access.
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.