# AI Hooks — BrandApp Playground

> Credit balance querying and streaming text generation with observable state transitions.

- Canonical page: https://brandapp-playground.vercel.app/hooks/ai
- Markdown: https://brandapp-playground.vercel.app/hooks/ai.md
- SDK module: `@reopt-ai/brandapp-sdk/react/hooks`

## Hooks

- `useAiCredits(sdk)` — cached credit balance
- `useAiStream(sdk)` — streaming generation with real-time state updates

The demo walks the stream lifecycle `idle → streaming → done` and reports token usage
once generation completes.

## Related

- [Text Completion](https://brandapp-playground.vercel.app/ai/complete.md)
- [Credits and Models](https://brandapp-playground.vercel.app/ai/credits.md)
- [React Hooks Overview](https://brandapp-playground.vercel.app/hooks.md)

---

Index of every document: https://brandapp-playground.vercel.app/llms.txt
Single-file copy: https://brandapp-playground.vercel.app/llms-full.txt
HTTP API description: https://brandapp-playground.vercel.app/openapi.json
