Cannot use own Anthropic API key

Hello, I get the following error trying to use Claude 4 Opus:

We’re experiencing high demand for Claude 4 Opus right now. Please switch to the ‘auto-select’ model, another model, or try again in a few moments.
(Request ID: 5cbbad32-9a49-4f85-bed1-edcd293a7e43)

No problem, I’ll use my own API key. I paste it into the custom API keys. It verifies just fine, yet I get the following error:

Unauthorized User API key
(Request ID: 424b1788-aca2-45bd-9184-bd18c8641ea0)

When I test with the same key, manually, it works fine:

jcherniak@JustinMacbookM4:/rechub$ read -s ANTHROPIC_API_KEY
jcherniak@JustinMacbookM4:/rechub$  curl https://api.anthropic.com/v1/messages   -H "Content-Type: application/json"   -H "x-api-key: $ANTHROPIC_API_KEY"   -H "anthropic-version: 2023-06-01"   -d '{
    "model": "claude-4-opus-20250514",
    "max_tokens": 25000,
    "messages": [
      {
        "role": "user",
        "content": "Test"
      }
    ]
}'  | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   562  100   405  100   157     56     21  0:00:07  0:00:07 --:--:--   101
{
  "id": "msg_01AoaTfcK2ufVeRoLDEc9mLT",
  "type": "message",
  "role": "assistant",
  "model": "claude-opus-4-20250514",
  "content": [
    {
      "type": "text",
      "text": "Hello! I'm here and ready to help. What would you like to test or talk about today?"
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 8,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 24,
    "service_tier": "standard"
  }
}

Trying to use my own key with claude-3.7-sonnet also doesn’t work

Unauthorized User API key
(Request ID: 00964301-92f8-43aa-89eb-91ce80cd9855)

Also tried claude-3.7-sonnet without max mode just to make sure that’s not the issue…

Unauthorized User API key
(Request ID: adc5eccf-dee0-4633-8165-1a1cbfe2518e)

Interestingly if I pipe it through Openrouter, it does work

Request dec1c52f-6b96-4ee5-ab00-a465e867a754

Hey, do you have an overridden base URL for the OpenAI API key? If so, reset it to the default settings. Also, if that doesn’t work, try using the model name claude-4-opus-20250514.

So clearing the OpenAI Base url and adding a custom model name fixed the anthropic key, but they are obviously separate (I didn’t override the Anthropic base url), so there is obviously a bug for you to fix here.

Also, doesn’t typing in a custom model name break Agent mode? Or am I misunderstanding how that works?

Yes, it’s a bug, and I hope it gets fixed. As for the model name, no, it should work like a regular one, but if the model name you have is working and is in the list of models, then adding a new one doesn’t make sense.