@aicr/sdk
v0.2.0
Published
AICR platform SDK — AI observability and governance for your apps
Maintainers
Readme
@aicr/sdk
AI observability and governance SDK. Auto-captures LLM calls with compliance-ready audit trails, PII detection, and EU AI Act readiness scoring.
Install
npm install @aicr/sdkUsage
import { AICR } from '@aicr/sdk'
const client = new AICR({
apiKey: 'your-api-key',
tenantId: 'your-tenant-id',
})
const result = await client.ask({
prompt: 'Summarize this document',
model: 'scout', // 'scout' (fast/cheap) or 'claude' (powerful)
maxTokens: 2048,
})
console.log(result.text)
console.log(result.eventId) // audit trail referenceWhat happens behind the scenes
- PII Gate — prompt is scanned for sensitive data (SSN, credit cards, emails). Critical PII blocks the request. Non-critical PII can be auto-redacted.
- LLM Call — routed through Cloudflare AI Gateway to the best-fit model.
- Audit Trail — every call is recorded in Spine (immutable event store) with token counts, latency, model used, and a prompt hash (no raw prompts stored).
- Compliance — events feed the EU AI Act readiness evaluator in the Govern worker.
Options
client.ask({
prompt: string // required
model?: 'scout' | 'claude' // default: 'scout'
maxTokens?: number // default: 2048
correlationId?: string // link related calls together
piiAction?: 'block' | 'redact' | 'skip' // default: 'block'
})Response
{
text: string
model: string // actual model used (e.g. 'deepseek/deepseek-chat-v3-0324')
provider: string // 'openrouter'
tokenUsage?: { promptTokens: number, completionTokens: number }
eventId: string // spine audit event ID
}License
MIT
