# AGENTS.md — API Plaza gateway

Model access for this repo goes through API Plaza (OpenAI-compatible aggregation gateway).

## Connection
- Base URL `https://api.apiplaza.ai/v1`; header `Authorization: Bearer $API_PLAZA_KEY` (env var).
- Official OpenAI SDKs work unchanged; only base_url and model ids differ.

## Endpoints
- `POST /v1/chat/completions` — chat, streaming (SSE), tools/function calling, vision parts.
- `POST /v1/images/generations` — synchronous, returns image URLs.
- `POST /v1/videos` → `GET /v1/videos/{task_id}` (poll ≥2s, queued→processing→completed) → `GET /v1/videos/{task_id}/content`.
- `GET /v1/models` — live model list; fetch instead of hardcoding.
- `POST https://api.apiplaza.ai/estimate` — price a call before sending (USD).

## Rules for agents
- Never hardcode API keys; read from environment.
- Never invent model ids; use /v1/models.
- 402 means no balance — surface to the user instead of retrying.
- 429 → exponential backoff. 5xx → safe to retry (failed requests are never billed).

Full reference: https://apiplaza.ai/llms-full.txt · Docs: https://apiplaza.ai/docs.html
