Skip to main content

AI Gateway Usage

ai-gateway-service is the only egress to LLM / embedding / TTS / moderation / image providers. Direct openai, anthropic, ? imports outside that service are blocked by ESLint and reviewed in PR.

Every persisted AI artifact carries an AIProvenance value object:

interface AIProvenance {
model: string; version?: string;
promptId?: string; promptVersion?: SemVer;
traceId: string; decisionId?: string;
local: boolean; generatedAt: ISODate;
reviewedBy?: UserId; reviewedAt?: ISODate;
cost?: { microUSD: number; tokens: { in: number; out: number } };
safety: { input: SafetyVerdict; output: SafetyVerdict };
cacheHit: boolean;
}

AI-generated content is created with status: draft_ai. Promotion to reviewed requires a human decisionId ? the domain enforces it; no infrastructure shortcut exists.