Skip to content

Align API key configuration: OpenRouter:ApiKey with OPEN_ROUTER_API_KEY fallback#2

Merged
pournasserian merged 2 commits into
ui-enhancementfrom
copilot/sub-pr-1
Mar 11, 2026
Merged

Align API key configuration: OpenRouter:ApiKey with OPEN_ROUTER_API_KEY fallback#2
pournasserian merged 2 commits into
ui-enhancementfrom
copilot/sub-pr-1

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

The README documented OpenRouter:ApiKey (nested) for appsettings.json, but appsettings.json used a flat OPEN_ROUTER_API_KEY key and all 23 agent components read Configuration["OPEN_ROUTER_API_KEY"] — three sources out of sync.

Changes

  • appsettings.json — switched to nested OpenRouter:ApiKey format to match README
  • All 23 Agent razor files — updated API key lookup to prefer OpenRouter:ApiKey with fallback to OPEN_ROUTER_API_KEY for backwards compatibility; error message updated to reflect both
// Before
var apiKey = Configuration["OPEN_ROUTER_API_KEY"] ??
    throw new InvalidOperationException("OPEN_ROUTER_API_KEY is not set in.");

// After
var apiKey = Configuration["OpenRouter:ApiKey"] ?? Configuration["OPEN_ROUTER_API_KEY"] ??
    throw new InvalidOperationException("OpenRouter:ApiKey (or OPEN_ROUTER_API_KEY) is not configured.");

The README required no changes — it already documented both options correctly.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

…KEY fallback

Co-authored-by: pournasserian <24959477+pournasserian@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on CSS variables and agent pages redesign Align API key configuration: OpenRouter:ApiKey with OPEN_ROUTER_API_KEY fallback Mar 11, 2026
@pournasserian pournasserian marked this pull request as ready for review March 11, 2026 23:53
@pournasserian pournasserian merged commit 12784a3 into ui-enhancement Mar 11, 2026
@pournasserian pournasserian deleted the copilot/sub-pr-1 branch March 11, 2026 23:53
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