Batoi AIF Docs

REST API Contract

Expose AIF through stable backend envelopes.

REST API Contract

AIF can be exposed through REST endpoints owned by the host application. The public contract should remain stable even when provider implementations change.

Response Envelope

{
  "ok": true,
  "data": {
    "text": "Generated response",
    "provider": "mock",
    "model": "mock-model",
    "audit_id": "evt_123"
  },
  "error": null
}

For errors:

{
  "ok": false,
  "data": null,
  "error": {
    "code": "policy_denied",
    "message": "This request is not allowed by the current policy."
  }
}

Endpoint Pattern

Use backend endpoints such as:

POST /api/aif/infer
GET /api/aif/providers
GET /api/aif/prompts
POST /api/aif/executions/{uid}/review

The exact route structure belongs to the host application. Keep user permissions, workspace context, provider secrets, and audit persistence on the backend.