Skip to content

fix: handle hosted demo credit-limit errors#670

Open
ProfTrader wants to merge 1 commit into
thesysdev:mainfrom
ProfTrader:codex/openui-friendly-credit-errors-fork
Open

fix: handle hosted demo credit-limit errors#670
ProfTrader wants to merge 1 commit into
thesysdev:mainfrom
ProfTrader:codex/openui-friendly-credit-errors-fork

Conversation

@ProfTrader

Copy link
Copy Markdown

Summary

Improves the hosted demo credit-limit handling so OpenRouter credit/rate-limit failures show the existing friendly demo-credits dialog instead of surfacing as a generic server error.

Related issue

Fixes #514

Changes

  • Keep the existing HTTP 402 handling.
  • Treat HTTP 429 provider responses as demo-credit exhaustion for the hosted demos.
  • Detect nested provider messages mentioning credits, quota, rate limits, too many requests, or insufficient funds.
  • Reuse the existing createDemoCreditsExhaustedResponse() payload so both playground and GitHub demo routes benefit without route-specific duplication.

Testing

  • pnpm --filter @openuidev/docs run types:check
  • pnpm exec prettier --check docs/lib/demo-credits.ts
  • git diff --check

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.

Fix error messaging for openui-chat example

1 participant