SDK Integration
Ship production traffic to a Monitor from your app.
The PeerLM SDK samples production requests and ships them to a Monitor asynchronously. It never throws into your request path.
Install
npm install @peerlm/sdk
# or
pip install peerlmTypeScript
import { PeerLMClient } from "@peerlm/sdk";
const peerlm = new PeerLMClient({
apiKey: process.env.PEERLM_API_KEY!,
monitorId: "your-monitor-id",
sampleRate: 0.05,
});
peerlm.track({
prompt: userMessage,
systemPrompt,
response: modelOutput,
model: "gpt-5.2",
tokensIn,
tokensOut,
latencyMs,
});Tips
- Prefer including
responseso Runs can use control parity. - Create the Monitor first, paste its ID into the SDK, then wait for events on the Monitor page.