Skip to content

Separate demo provider credentials - #43

Merged
yoavf merged 1 commit into
mainfrom
codex/separate-demo-provider-key
Jul 28, 2026
Merged

Separate demo provider credentials#43
yoavf merged 1 commit into
mainfrom
codex/separate-demo-provider-key

Conversation

@yoavf

@yoavf yoavf commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • route /translate through LLM_API_KEY and /demo through a dedicated DEMO_LLM_API_KEY
  • accept DEMO_OPENROUTER_API_KEY as an alias without ever falling back to the app credential
  • return a clean HTTP 503 demo message when the demo key is absent or rejected
  • document independent tracking and shutdown behavior

Why

App and browser-demo traffic currently share one OpenRouter key, which makes provider-side usage attribution difficult and prevents either surface from being revoked independently.

Behavior

  • /translate continues using LLM_API_KEY or OPENROUTER_API_KEY
  • /demo uses only DEMO_LLM_API_KEY or DEMO_OPENROUTER_API_KEY
  • if the demo credential is missing or revoked, the browser receives the browser demo is temporarily unavailable; try again later
  • provider names, credential details, and upstream response bodies are not exposed

Validation

  • cargo test --workspace --all-targets
  • cargo clippy --workspace --all-targets -- -D warnings
  • npm run test:demo — 31/31 passed
  • npm run build:demo
  • endpoint tests verify distinct bearer tokens plus missing and revoked demo-key behavior

Deployment

Set a separately created OpenRouter key as the Fly secret DEMO_LLM_API_KEY before merging. If it is not set, the demo is intentionally disabled while CLI translations remain available.

Greptile Summary

Separates browser-demo provider credentials from CLI translation credentials.

  • Adds dedicated DEMO_LLM_API_KEY and DEMO_OPENROUTER_API_KEY configuration without fallback to application credentials.
  • Returns a generic HTTP 503 response when the demo credential is absent or an upstream demo request fails.
  • Documents independent credential tracking, revocation, and unauthenticated self-hosted-provider configuration.

Confidence Score: 5/5

The pull request appears safe to merge with no actionable defects identified.

The current route graph consistently selects the dedicated demo credential for /demo and the application credential for /translate, handles missing and rejected demo credentials without leaking provider details, and retains valid empty-key behavior for unauthenticated providers.

Important Files Changed

Filename Overview
crates/server/src/main.rs Routes demo requests through the dedicated optional credential, preserves the application credential for translations, sanitizes demo provider failures, and adds focused endpoint tests.
README.md Documents dedicated demo credential aliases, isolation guarantees, unavailable behavior, and explicit empty-key support.
ARCHITECTURE.md Updates the architecture and local startup example to describe independently managed CLI and demo credentials.

Reviews (1): Last reviewed commit: "Separate demo provider credentials" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

The macOS CLI preview for this PR is ready. With GitHub CLI authenticated, copy this one command to download and run it:

preview_dir="$(mktemp -d)" && gh run download 30304085021 --repo yoavf/jst --name jst-pr-preview-macos-universal --dir "$preview_dir" && chmod +x "$preview_dir/jst" && "$preview_dir/jst" --dry list files in the current directory

Replace the example arguments after jst to test another command. The artifact is retained for 7 days.

View the preview build

@yoavf
yoavf marked this pull request as ready for review July 28, 2026 03:09
@yoavf
yoavf merged commit 0f05618 into main Jul 28, 2026
6 checks passed
@yoavf
yoavf deleted the codex/separate-demo-provider-key branch July 28, 2026 06:48
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