@raindrop-ai/azure-openai
v0.1.1
Published
Raindrop integration for Azure OpenAI
Keywords
Readme
@raindrop-ai/azure-openai
Raindrop integration for Azure OpenAI. Automatically captures chat.completions.create() calls by wrapping the AzureOpenAI client.
Installation
npm install @raindrop-ai/azure-openai openaiUsage
import { createRaindropAzureOpenAI } from "@raindrop-ai/azure-openai";
import { AzureOpenAI } from "openai";
const raindrop = createRaindropAzureOpenAI({
writeKey: "your-write-key",
userId: "user-123",
});
const client = new AzureOpenAI({
endpoint: "https://your-resource.openai.azure.com",
apiKey: "...",
apiVersion: "2024-10-21",
});
const wrapped = raindrop.wrap(client);
const response = await wrapped.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello!" }],
});
await raindrop.shutdown();What gets captured
- Chat completions: input messages, output text, model, token usage (prompt/completion)
- Errors: captured with error status on spans, re-thrown to caller
Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| writeKey | string | - | Raindrop API write key (omit to disable telemetry) |
| endpoint | string | https://api.raindrop.ai/v1/ | Raindrop API endpoint |
| userId | string | - | Associate all events with a user |
| convoId | string | - | Group events into a conversation |
| projectId | string | - | Route events to a specific project (slug); omit for the default Production project |
| debug | boolean | false | Enable verbose logging |
| maxTextFieldChars | number | 1000000 | Per-field character cap for captured input/output text |
Projects
If your org has multiple projects, route events to a specific one by passing its slug as projectId:
const raindrop = createRaindropAzureOpenAI({
writeKey: "your-write-key",
projectId: "support-prod",
});This sets the X-Raindrop-Project-Id header on every event. Omit it (or pass "default") to use your org's default Production project — the existing behavior. Single-project orgs need nothing new.
Payload size limits
Captured input/output text is capped at 1,000,000 characters per field by
default and truncated with a ...[truncated by raindrop] marker (the
result, marker included, never exceeds the limit). Multi-part message content
(e.g. base64 image blocks) is serialized under the same budget, so multi-MB
payloads cost the cap — not the payload — on your calling thread, and
oversized events land truncated instead of being dropped at the ingest size
limit. Tune it via maxTextFieldChars.
Testing
pnpm test