OpenGenerativeUI icon indicating copy to clipboard operation
OpenGenerativeUI copied to clipboard

feat(app): choose OpenRouter or TypeSafe for Jev in the API keys dialog

Open tbrandenburg opened this issue 1 week ago • 0 comments

Problem

Visitors who bring their own keys can only enter a TypeSafe key for Jev. A visitor with an OpenRouter key cannot use it for visualization routing.

Proposal

Depends on the shared-server provider support in the previous issue.

  • The API keys dialog gets a "Jev provider" selector (TypeSafe default, OpenRouter) and relabels the key field.
  • The choice travels in a new x-jev-provider header alongside the existing key headers. The Next.js proxy validates it (typesafe | openrouter), the agent middleware strips it like the other credential headers, and it is part of the BYOK thread-ID namespace so checkpoints never mix providers.
  • POST /credentials/validate tests the selected provider's endpoint.
  • Omitting the header keeps today's TypeSafe behaviour, so existing clients are unaffected.

Scope

apps/app (dialog, provider-keys context/lib, CSS, tests), apps/agent/src/credentials.py plus tests, README and docs.

Security considerations

  • Same handling as the existing key headers: memory-only in the browser, not persisted, stripped before the inner app, tracing disabled for BYOK.
  • Strict allow-list for the provider value; unknown values are rejected as invalid keys.

Definition of done

  • Dialog flow works with each provider against the real APIs (validated end to end with real OpenAI and OpenRouter keys).
  • Unit tests for header parsing, thread namespacing, and the dialog.
  • Existing TypeSafe flow unchanged.

Related

#98 tracks the separate question of skipping the key prompt when the server already holds keys; this issue does not change that gate.

tbrandenburg avatar Nov 22 '26 13:11 tbrandenburg