# LLM Gateway: API Plaza

This project calls LLM / image / video models through API Plaza, an OpenAI-compatible gateway.

- Base URL: `https://api.apiplaza.ai/v1`
- Auth: `Authorization: Bearer $API_PLAZA_KEY` (env var; never hardcode)
- Use the official OpenAI SDK; only base_url and model ids differ from stock OpenAI.
- Live model list: `GET /v1/models`. Prefer fetching it over hardcoding model ids.
- Chat: `POST /v1/chat/completions` (stream/tools/vision supported).
  Images: `POST /v1/images/generations`. Video (async): `POST /v1/videos` → poll `GET /v1/videos/{task_id}`.
- Errors are OpenAI-shaped. 401 bad key · 402 balance · 429 backoff-retry · 5xx retry (never billed).
- Price a call first if needed: `POST https://api.apiplaza.ai/estimate`.
- Full reference: https://apiplaza.ai/llms-full.txt
