Skip to content

fix(chat): return 401 without server env-var API-key fallback - #89

Merged
xcjs merged 1 commit into
mainfrom
chore/remove-env-key-fallback
Oct 3, 2026
Merged

xcjs merged 1 commit into
mainfrom
chore/remove-env-key-fallback

Conversation

@xcjs

@xcjs xcjs commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Closes #80

Summary

  • The chat API route no longer reads API keys from the server environment (\OPENAI_API_KEY, \ANTHROPIC_API_KEY, \GEMINI_API_KEY, \GOOGLE_GENERATIVE_AI_API_KEY, \DEEPSEEK_API_KEY\ env fallbacks removed)
  • Missing/blank client key returns 401 directing the user to Settings, as before
  • Keys now come exclusively from the per-request client payload (client-side Settings)

Scope

\server/api/chat.post.ts\ only — matches issue #80's ## Files.

Done when (from #80)

  • no key is ever read from the environment

Verification


  • pm run typecheck\ passes (exit 0)

  • g 'process\.env' server/api/chat.post.ts\ now shows only the two *_BASE_URL\ fallbacks (URLs, not keys) — env-var key reads are gone

@xcjs
xcjs requested a review from Sullux October 3, 2026 00:27
@m-vawter m-vawter mentioned this pull request Oct 3, 2026

@m-vawter m-vawter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. Verified locally: with this branch merged onto the #91 e2e suite, 3/3 pass, and the route now takes the key only from the request (the 401 path is unchanged). Two small things, neither blocking:

  1. The new comment cites ADR 0012, but NEXT.md frames this step as ADR 0005 conformance, the server-side provider proxy record. Citing 0005 would point readers at the decision this completes.
  2. A follow-up idea: a keyless local endpoint (Ollama through the custom OpenAI-compatible provider) still gets a 401, same as before. With a self-hostable north star, allowing an empty key for the custom provider might be worth an issue.

@xcjs
xcjs merged commit e8e443d into main Oct 3, 2026
3 checks passed
@xcjs
xcjs deleted the chore/remove-env-key-fallback branch October 3, 2026 01:31
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.

0.2 Remove server env-var API-key fallback

2 participants