Skip to content

feat: remember an API key per provider - #8

Merged
brunobuddy merged 1 commit into
mainfrom
feat/provider-api-keys
Jul 20, 2026
Merged

feat: remember an API key per provider#8
brunobuddy merged 1 commit into
mainfrom
feat/provider-api-keys

Conversation

@brunobuddy

Copy link
Copy Markdown
Member

💭 Why

Switching provider preset kept the previous provider's API key in the field. Clearing it didn't stick either, so an OpenAI sk-… would go out as an Anthropic x-api-key and 401. There was no way to get an earlier key back short of re-pasting it.

✨ What changed

  • API keys now live in a per-provider map instead of one shared slot.
  • Selecting a provider shows its own key, blank until you set one.
  • Coming back to a provider restores the key you already typed.
  • Clear drops only that provider's key.
  • Editing the Base URL still flips to Custom, carrying the current key across (unless Custom is already keyed).
  • The key field re-masks on switch, so a revealed key can't expose the next provider's secret.
  • README documents the per-provider behavior.

👤 For users

Pick OpenAI, paste your key, switch to Anthropic: the field is empty instead of preloaded with the wrong key. Switch back to OpenAI and your key is there again.

🔧 For operators

None. Storage stays sessionStorage-only (cleared on tab close), now under wingman:apiKeys. The old wingman:apiKey slot is migrated onto whichever provider was active, then dropped, so an open session doesn't lose its key.

📝 Notes

Verified in a browser across all 16 presets' switching paths: key isolation, restore, clear, reload persistence, legacy migration, and the actual outgoing request (Anthropic sends x-api-key, OpenAI sends Bearer, no cross-contamination).

A single shared key meant switching preset carried the previous
provider's credential over. Clearing it didn't help either — the next
provider inherited whatever was left in the field, so an OpenAI `sk-…`
went out as an Anthropic `x-api-key` and 401'd.

Keys now live in a per-provider map. Selecting a provider shows its own
key (blank until set), and coming back restores the one already typed.
Clearing drops that provider's entry only. Editing the Base URL still
flips to Custom, which carries the current key across unless Custom is
already keyed.

Storage stays sessionStorage-only. The old shared `wingman:apiKey` slot
is migrated onto the provider that was active, then dropped.
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wingman Ready Ready Preview Jul 12, 2026 4:06pm

Request Review

@brunobuddy
brunobuddy merged commit 29a594e into main Jul 20, 2026
2 checks passed
@brunobuddy
brunobuddy deleted the feat/provider-api-keys branch July 20, 2026 09:17
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.

1 participant