@openrng/auto
Auto-instrument AI SDK calls to emit VEO-2 objects. One line, zero code changes.
Install
npm install @openrng/auto @openrng/core
Quick Start
import OpenAI from 'openai';
import { auto } from '@openrng/auto';
const client = auto(new OpenAI());
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'What is the capital of France?' }],
});
With Anthropic
import Anthropic from '@anthropic-ai/sdk';
import { auto } from '@openrng/auto';
const client = auto(new Anthropic());
const message = await client.messages.create({
model: 'claude-4-sonnet',
messages: [{ role: 'user', content: 'Hello' }],
});
With Signing
import { auto } from '@openrng/auto';
import { generateSigningKeys } from '@openrng/core';
const keys = generateSigningKeys();
const client = auto(new OpenAI(), {
privateKey: keys.privateKey,
provider: 'my-service',
});
Accessing VEOs
import { auto, MemoryStore } from '@openrng/auto';
const store = new MemoryStore();
const client = auto(new OpenAI(), { store });
await client.chat.completions.create({ ... });
const veos = store.list();
console.log(veos[0].execution?.model_id);
console.log(veos[0].execution?.cost);
Callback on Every VEO
const client = auto(new OpenAI(), {
onVEO: (veo) => {
console.log('AI call recorded:', veo.object_id);
},
});
What Gets Captured
Every instrumented call produces a VEO with:
execution.prompt_hash | SHA-256 of the prompt/messages |
execution.output_hash | SHA-256 of the response |
execution.model_id | Model from the request |
execution.latency_ms | Measured response time |
execution.cost | Token usage from response |
execution.tool_calls | Tool/function calls if any |
confidence.score | 700 (success) or 100 (error) |
lifecycle.state | 'created' or 'signed' |
Instrumented Methods
| OpenAI | chat.completions.create, completions.create, embeddings.create, images.generate |
| Anthropic | messages.create |
| Generic | create, generate, complete |
Safety Guarantees
- Never breaks your API calls — VEO emission errors are caught and logged, never thrown
- No SDK dependency — works with any client object via ES Proxy
- Zero performance impact — VEO creation happens after the API call returns
Related Packages
@openrng/core | Types, schema, signing, validation |
@openrng/auto | Auto-instrumentation (this package) |
License
MIT — OpenRNG