Cherry Studio

How to fix Cherry Studio returning 401 or an invalid API key

A 401 means the request reached the AI Code With server but failed authentication. The issue is in the API key itself, its validity, or the account state — not in the API address or model.

Start with these checks

The request reached the server, but authentication failed.

  • Cherry Studio shows 401, Unauthorized, or Invalid API Key after sending a message.
  • The pasted API key is incomplete, has extra spaces, or is the wrong key
  • Open Cherry Studio Settings → Model Services and select the AI Code With provider
401UnauthorizedInvalid API Key

01

Confirm the request reached the server

401 / Unauthorized means the request reached the AI Code With endpoint and was rejected at authentication. Do not change the API address or model; check the API key first.

02

Re-paste and verify the API key

In Cherry Studio Settings → Model Services, select the AI Code With provider and paste the full API key into the API Key field. Avoid trailing newlines or spaces when copying.

  1. 1Open Cherry Studio Settings → Model Services and select the AI Code With provider
  2. 2Re-paste the full API key into the API Key field, with no extra spaces

03

Verify the key and account

Confirm the key is active and the account has balance on the AI Code With API key page. After saving, send a short message — no more 401 means the credential chain works.

  1. 1Re-paste the full API key into the API Key field, with no extra spaces
  2. 2Confirm the key is a valid AI Code With API key (see the API key page)

If it is still not fixed

Sources

Reconfigure

Return to the integration center and continue the setup steps.

Return to the related setup step