Complete reference for the Preksha AI API
https://api.preksha.ai/v1All API requests require authentication using an API key
Include your API key in the X-API-Key header:
X-API-Key: pk_live_your_api_keyAPI keys can be created and managed in your project settings.
Start sending events in minutes
import { PrekshaClient } from '@preksha/sdk';
const preksha = new PrekshaClient({
apiKey: process.env.PREKSHA_API_KEY,
projectId: 'your-project-id'
});
// After your AI call completes
await preksha.ingest({
model: 'claude-3-sonnet',
inputTokens: 456,
outputTokens: 1234,
clientId: 'user-123',
inputHash: hash(prompt), // Hash, not raw content
outputHash: hash(response),
metadata: {
endpoint: '/api/chat',
cached: false
}
});Available REST API endpoints
/api/v1/ingest/api/v1/events/api/v1/events/:id/api/v1/stats/api/v1/alert-rules/api/v1/clients/api/v1/blocklistPython
v1.2.0
JavaScript/TypeScript
v1.1.5
Go
v0.9.0
Ruby
v0.8.0
Enterprise plans have higher limits. Contact sales for details.