openapi: 3.1.0 info: title: AIA Governance version: '1.0.0' description: | Owner of the project as a TENANT: budget in currency, data classification, model access policies and showback. The inference-router reads a project policy from here and keeps a local cache with a short TTL; if this service goes down, the router keeps serving on the last policy and flags `policy_stale`. license: { name: MIT } servers: - url: http://localhost:8080 security: - bearerAuth: [] tags: - name: projects - name: budget - name: policies paths: /v1/projects: post: operationId: createProject tags: [projects] summary: Creates a project parameters: - $ref: './_shared.yaml#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/CreateProjectRequest' } responses: '201': description: Project created content: application/json: schema: { $ref: '#/components/schemas/Project' } '400': { $ref: './_shared.yaml#/components/responses/BadRequest' } '403': { $ref: './_shared.yaml#/components/responses/Forbidden' } '409': description: A project with this slug already exists content: application/problem+json: schema: { $ref: './_shared.yaml#/components/schemas/ProblemDetails' } get: operationId: listProjects tags: [projects] summary: Lists the projects visible to the principal parameters: - $ref: './_shared.yaml#/components/parameters/Cursor' - $ref: './_shared.yaml#/components/parameters/Limit' responses: '200': description: A page of projects content: application/json: schema: allOf: - $ref: './_shared.yaml#/components/schemas/Page' - type: object properties: items: { type: array, items: { $ref: '#/components/schemas/Project' } } /v1/projects/{projectId}: parameters: - name: projectId in: path required: true schema: { type: string } get: operationId: getProject tags: [projects] summary: Details a project responses: '200': description: The project content: application/json: schema: { $ref: '#/components/schemas/Project' } '404': { $ref: './_shared.yaml#/components/responses/NotFound' } /v1/projects/{projectId}/budget: parameters: - name: projectId in: path required: true schema: { type: string } put: operationId: setBudget tags: [budget] summary: Sets the budget for the period description: | Budget in CURRENCY, not tokens: cost per token varies by provider, and what the business controls is spend (reference doc 01, finding 3.3). requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SetBudgetRequest' } responses: '200': description: Budget updated content: application/json: schema: { $ref: '#/components/schemas/Budget' } '403': { $ref: './_shared.yaml#/components/responses/Forbidden' } '404': { $ref: './_shared.yaml#/components/responses/NotFound' } get: operationId: getBudget tags: [budget] summary: Reads the budget and the spend for the period responses: '200': description: The budget content: application/json: schema: { $ref: '#/components/schemas/Budget' } '404': { $ref: './_shared.yaml#/components/responses/NotFound' } /v1/projects/{projectId}/policy: parameters: - name: projectId in: path required: true schema: { type: string } get: operationId: getProjectPolicy tags: [policies] summary: The effective project policy description: | Consumed by the inference-router on every request (through a local cache with a TTL). Carries classification, allowed zones, permitted aliases and limits. responses: '200': description: The effective policy content: application/json: schema: { $ref: '#/components/schemas/ProjectPolicy' } headers: Cache-Control: schema: { type: string } description: A short TTL; the router uses it as a revalidation hint. '404': { $ref: './_shared.yaml#/components/responses/NotFound' } put: operationId: setProjectPolicy tags: [policies] summary: Changes the project policy requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SetPolicyRequest' } responses: '200': description: Policy updated content: application/json: schema: { $ref: '#/components/schemas/ProjectPolicy' } '403': { $ref: './_shared.yaml#/components/responses/Forbidden' } /health/live: get: operationId: liveness security: [] summary: Liveness probe responses: '200': description: The process is alive content: application/json: schema: { type: object, properties: { status: { type: string } } } /health/ready: get: operationId: readiness security: [] summary: Readiness probe responses: '200': description: Ready content: application/json: schema: { type: object, properties: { status: { type: string } } } '503': { $ref: './_shared.yaml#/components/responses/ServiceUnavailable' } components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT schemas: CreateProjectRequest: type: object required: [slug, name, data_classification, legal_basis, purpose] properties: slug: type: string pattern: '^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$' description: Stable tenant identifier. It never changes. name: { type: string, minLength: 3, maxLength: 120 } description: { type: string, maxLength: 1000 } data_classification: { $ref: './_shared.yaml#/components/schemas/DataClassification' } legal_basis: type: string description: Legal basis for processing (LGPD, art. 7). Required at creation. purpose: type: string description: Purpose of processing (LGPD). Required at creation. cost_center: { type: string } owner_principal_id: { type: string } additionalProperties: false Project: type: object required: [id, slug, name, data_classification, created_at] properties: id: { type: string } slug: { type: string } name: { type: string } description: { type: string } data_classification: { $ref: './_shared.yaml#/components/schemas/DataClassification' } legal_basis: { type: string } purpose: { type: string } cost_center: { type: string } owner_principal_id: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } SetBudgetRequest: type: object required: [limit, period] properties: limit: { $ref: './_shared.yaml#/components/schemas/Money' } period: { type: string, enum: [daily, monthly] } block_at_limit: type: boolean default: true description: When `false`, crossing the limit only alerts; it does not block. alert_thresholds: type: array items: { type: number, minimum: 0, maximum: 1 } default: [0.5, 0.8, 1.0] additionalProperties: false Budget: type: object required: [project_id, limit, spent, period, period_start, period_end] properties: project_id: { type: string } limit: { $ref: './_shared.yaml#/components/schemas/Money' } spent: { $ref: './_shared.yaml#/components/schemas/Money' } reserved: allOf: [{ $ref: './_shared.yaml#/components/schemas/Money' }] description: Reserved by in-flight calls, not yet committed. period: { type: string, enum: [daily, monthly] } period_start: { type: string, format: date-time } period_end: { type: string, format: date-time } block_at_limit: { type: boolean } alert_thresholds: { type: array, items: { type: number } } ModelRule: type: object required: [alias, allowed] properties: alias: { type: string } allowed: { type: boolean } max_output_tokens: { type: integer } ProjectPolicy: type: object required: [project_id, data_classification, allowed_data_zones, version] properties: project_id: { type: string } data_classification: { $ref: './_shared.yaml#/components/schemas/DataClassification' } allowed_data_zones: type: array description: Derived from the classification; it may be narrowed, never widened. items: { $ref: './_shared.yaml#/components/schemas/DataZone' } model_rules: type: array items: { $ref: '#/components/schemas/ModelRule' } max_concurrent_requests: { type: integer, minimum: 1, default: 20 } content_capture: type: boolean default: false description: Stores prompt and answer in the audit, after PII redaction. version: type: integer description: Increments on every change. The router uses it to invalidate its cache. SetPolicyRequest: type: object properties: allowed_data_zones: type: array items: { $ref: './_shared.yaml#/components/schemas/DataZone' } model_rules: { type: array, items: { $ref: '#/components/schemas/ModelRule' } } max_concurrent_requests: { type: integer, minimum: 1 } content_capture: { type: boolean } additionalProperties: false