Skip to content

Show friendly popup when hosted demo credits are exhausted #575

@vishxrad

Description

@vishxrad

Problem

When API/OpenRouter credits expire on hosted OpenUI demos, the demos fail in confusing ways: raw provider errors, empty assistant turns, or loading states that appear stuck. This hurts conversion because visitors do not understand that the hosted demo is temporarily unavailable.

Expected behavior

Detect credit/quota exhaustion from the hosted demo API routes and show a friendly popup that says the hosted demo credits are being recharged. Until then, users should be directed to download the repo and run the demo locally.

Suggested copy:

Hosted demo credits are recharging
We're recharging the hosted demo credits. Until then, please download the repo and run it locally to see the live demo.

Include local run instructions:

git clone https://github.com/thesysdev/openui.git
cd openui
pnpm install
echo "OPENAI_API_KEY=sk-your-key-here" > examples/openui-chat/.env.local
pnpm --filter openui-chat dev

Affected surfaces

  • /playground
  • /demo/github
  • /docs/openui-lang live chat demo
  • docs overview chat modal / /api/chat

Notes

OpenRouter uses HTTP 402 for insufficient credits. In SDK/streaming paths, this can be flattened into messages such as "requires more credits" or "can only afford", so the handler should prefer structured status/code detection and only fall back to message matching when necessary.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions