@raindrop-ai/azure-openai
v0.1.2
Published
Raindrop integration for Azure OpenAI
Maintainers
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.
Application Git identity
Each client reports the application commit SHA when it can determine one. Local Git discovery runs in the background and never delays or fails application calls. Automatic branch discovery is off by default.
Use appGit to override detection or opt out:
const raindrop = createRaindropAzureOpenAI({
writeKey: "your-write-key",
appGit: {
commitSha: "0123456789abcdef0123456789abcdef01234567",
commitDirty: false,
branch: "main",
detectBranch: true,
sourceDirectory: "/path/to/application",
},
});
// Disable all application Git reporting.
const withoutGit = createRaindropAzureOpenAI({
writeKey: "your-write-key",
appGit: false,
});commitSha, commitDirty, and branch are explicit overrides. detectBranch opts into automatic branch lookup, sourceDirectory selects the application repository, and autoDetect: false disables automatic sources while retaining explicit values.
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