# OpenAPI Source And Renderers

The canonical REST contract is generated by:

```text
packages/cli/src/api/openapi.ts
```

Runtime docs:

| Path | Purpose |
| --- | --- |
| `/openapi.json` | Canonical OpenAPI 3.0 JSON |
| `/openapi.yaml` | YAML form of the same spec |
| `/v3/api-docs` | OpenAPI alias |
| `/swagger.json` | Swagger-era alias |
| `/api-docs` | OpenAPI alias |
| `/docs` | Swagger UI |
| `/api/docs` | Swagger UI alias |
| `/swagger-ui` | Swagger UI alias |
| `/redoc` | ReDoc renderer |

Swagger UI attempts local assets first and can fall back to a CDN if available. Offline clients should prefer `/openapi.json`.

## Contract Rule

When docs and behavior differ:

1. Check the live daemon `/openapi.json`.
2. Check `packages/cli/src/api/openapi.ts`.
3. Check route implementation in `packages/cli/src/api/serve.ts` and `packages/cli/src/api/routes-v1.ts`.
4. Patch this docs directory after the behavior is confirmed.

## AsyncAPI

The voicechat WebSocket has an AsyncAPI description generated from the same schema definitions. See `docs/rest/endpoints/voice-vision.md`.
