Hey, I’ve created multiple API keys from the dashboard. All show “Enabled” and “Unlimited,” but every one fails with 401 Unauthorized when I use them in Continue or via PowerShell. There’s no option to scope the key or set a default model during creation. I need a key that works with anthropic/claude-3-opus in external apps. Can you confirm how to generate a fully API-enabled key?
#Help needed @Toven
38 messages · Page 1 of 1 (latest)
I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.
To help debug your 401 Unauthorized issue, I need a bit more info:
- Can you provide the exact error response (including any message body)?
- Are you passing the API key in the header as Authorization: Bearer sk-or-v1-... ?
- Can you share the relevant code snippet or CLI command you’re using to call anthropic/claude-3-opus?
There’s no need to set a default model or scope during key creation. The docs state: "OpenRouter provides an OpenAI-compatible completion API to 400+ models & providers that you can call directly, or using the OpenAI SDK." You should generate your API key at Create API key and use it with the correct base URL and headers—see sample code in the docs for details Claude 3 Opus API.
Once you provide the details above, I can help pinpoint the issue. If this persists across all keys, there may be an account-specific problem—billing or account restrictions can cause 401s. For account or billing issues, please email [email protected].
-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.
@worthy rune i used a extension on vs code and it is saying invalid key it means it doe not work can u fix it
pls
Thanks for the extra details. To help resolve "invalid key" errors with your OpenRouter API key in VS Code extensions or external apps, please double-check the following:
-
Are you entering your API key in this format?
Authorization: Bearer sk-or-v1-your-key-hereThe API key must go in the
Authorizationheader as described in the API docs. Some tools require you to paste only the key (sk-or-v1-...), others want the whole header—check the extension instructions OAuth PKCE Guide. -
Are you using the correct endpoint? For completions, it should be:
https://openrouter.ai/api/v1/chat/completionsThe model value should be exactly:
anthropic/claude-3-opus -
Can you paste the exact error message (not just "invalid key") the extension or PowerShell returns?
If your key is still rejected as invalid, and you have confirmed the steps above, this could indicate an account or billing issue. For key/account issues, email [email protected]. They can investigate account-specific problems.
Let me know the error message, the extension name, and how you are entering the key so I can give more direct help.
-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.
I don't have specific documentation for generating a fully API-enabled key for anthropic/claude-3-opus. However, the OpenRouter API documentation states: "OpenRouter provides an OpenAI-compatible completion API to 400+ models & providers that you can call directly, or using the OpenAI SDK." You only need to:
- Create an API key at Create API key
- Use the key in the Authorization header as Bearer sk-or-v1-...
- Set the correct model identifier (e.g., anthropic/claude-3-opus)
- Use the correct base URL: https://openrouter.ai/api/v1
If your keys are enabled/unlimited but you still get 401 errors everywhere, this could be an account or billing issue. For any account or billing issues, please email [email protected].
If you want further technical troubleshooting, please provide:
- The full 401 error response you're getting
- The exact code or command you’re using
- Confirmation that you’re setting the Authorization header correctly
This will help mods or support diagnose the problem.
For more details, see the API Reference.
-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.
@worthy rune Hey, I’ve created multiple API keys from the dashboard. All show “Enabled” and “Unlimited,” but every one fails with 401 Unauthorized when I use them in Continue or via PowerShell. There’s no option to scope the key or set a default model during creation. I need a key that works with anthropic/claude-4.1-opus in external apps. Can you confirm how to generate a fully API-enabled key?
make sure you've set Continue to use OpenRouter, and/or set the base URL correctly
@clear jungle yea i have done that it says after typing something, invalid key
@clear jungle can i get a new working claude opus 4.1 key please
@clear jungle Hey, I’ve created multiple API keys from the dashboard. All show “Enabled” and “Unlimited,” but every one fails with 401 Unauthorized when I use them in Continue or via PowerShell. There’s no option to scope the key or set a default model during creation. I need a key that works with anthropic/claude-4.1-opus in external apps. Can you confirm how to generate a fully API-enabled key?
@amber tundra please don't spam ping / DM
by clicking the Create API Key button on https://openrouter.ai/settings/keys
@worthy rune okay i am sorry
@clear jungle i have did that but it always say invalid key
@clear jungle in Continue
okay
show us the config
was about to link that
your config looks wrong
- name: claude-opus
provider: openrouter
model: anthropic/claude-opus-4.1
apiBase: https://openrouter.ai/api/v1
apiKey: <YOUR_OPEN_ROUTER_API_KEY>```
it shows needing to add the base url
here is my env file
it should be like this
okay i will add that and inform
replace the existing one
probably should delete these images