Skip to content

Comments

Avoid requiring static API key for OAuth Login#100

Merged
jamiepine merged 2 commits intospacedriveapp:mainfrom
egenvall:bugfix/anthropic-oauth-token
Feb 21, 2026
Merged

Avoid requiring static API key for OAuth Login#100
jamiepine merged 2 commits intospacedriveapp:mainfrom
egenvall:bugfix/anthropic-oauth-token

Conversation

@egenvall
Copy link
Contributor

Background

The addition of #76 based on #32 works by taking prescedence over the anthropic_key in config.toml.
However, the main improvement of the OAuth flow with spacebot auth login is to avoid having a fixed API key set for anthropic.

Issue

If no anthropic_key is set in the conf, the LLM calls will fail with a poorly descriptive message unknown provider anthropic when the routing model is set to anthropic/..

Solution

Resolve the anthropic key provider in the model configuration so that it can use the OAuth token even if no configuration entry for anthropic_key is set.

Test

Prerequisites

spacebot auth login
[ ] Remove anthropic_key from config.toml prior to this PR
[ ] Bot will not respond and -f -d will show the unknown provider error
[ ] Check out PR & run in dev
[ ] Bot is now responsive

Considerations

Having no API Keys set at all currently hows a yellow warning banner in the web dashboard.

cc @Marenz

@Marenz

This comment was marked as outdated.

@Marenz
Copy link
Contributor

Marenz commented Feb 21, 2026

This is the right approach — resolving the Anthropic provider at the LlmManager level with an explicit match on all four cases (static+oauth, static-only, oauth-only, neither) is much cleaner than always registering a provider with an empty key.

I had a workaround for the same issue in #84 but dropped it in favor of this. #84 now only has the MiniMax routing fix.

@egenvall
Copy link
Contributor Author

This is the right approach — resolving the Anthropic provider at the LlmManager level with an explicit match on all four cases (static+oauth, static-only, oauth-only, neither) is much cleaner than always registering a provider with an empty key.

I had a workaround for the same issue in #84 but dropped it in favor of this. #84 now only has the MiniMax routing fix.

Nice, makes sense!

Copy link
Contributor

@Marenz Marenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jamiepine jamiepine merged commit 3805e0a into spacedriveapp:main Feb 21, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants