# Text Completion — BrandApp Playground

> Streaming (SSE) and non-streaming text generation, with usage metadata on both paths.

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

## API

- `ai.stream({ messages })` — token-by-token output, returns an async iterable
- `ai.complete({ messages })` — the full result in one JSON payload
- `ai.streamWithMetadata()` — streams tokens and resolves a metadata promise carrying
  usage once the stream ends

The demo drives the streaming route over Server-Sent Events; the code panel shows both
the server route handler and the client consumption pattern.

## Related

- [AI SDK Provider](https://brandapp-playground.vercel.app/ai/provider.md)
- [Credits and Models](https://brandapp-playground.vercel.app/ai/credits.md)
- [AI Hooks](https://brandapp-playground.vercel.app/hooks/ai.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
