Skip to main content

Documentation Index

Fetch the complete documentation index at: https://raindrop.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Installation

npm install @raindrop-ai/azure-openai openai

Quick Start

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: "What is the capital of France?" }],
});

console.log(response.choices[0].message.content);
await raindrop.shutdown();

What Gets Traced

  • Chat completions — input messages (user text only), output text, model, token usage (prompt/completion)
  • Finish reasonazure_openai.finish_reason (stop, length, content_filter, tool_calls)
  • Extended tokensai.usage.cached_tokens (prompt cache hits) and ai.usage.thoughts_tokens (reasoning tokens for o1/o3 models)
  • Errors — captured with error status, re-thrown to caller

Configuration

const raindrop = createRaindropAzureOpenAI({
  writeKey: "your-write-key",       // Optional: your Raindrop write key (omit to disable telemetry)
  endpoint: "...",          // Optional: custom Raindrop API endpoint
  userId: "user-123",      // Optional: associate events with a user
  convoId: "convo-456",    // Optional: conversation/thread ID
  debug: false,             // Optional: enable verbose logging
});

Flushing and Shutdown

await raindrop.flush();     // flush pending data
await raindrop.shutdown();  // flush + release resources

User Identification

raindrop.identify("user-123", { plan: "pro", name: "Alice" });

Tracking Signals

raindrop.trackSignal({
  eventId: "evt-abc",
  name: "thumbs_up",
  signalType: "feedback",
  sentiment: "POSITIVE",
  comment: "Great response!",
});

Factory Function (Backwards-Compatible)

Python
from raindrop_azure_openai import create_raindrop_azure_openai

raindrop = create_raindrop_azure_openai(api_key="rk_...", user_id="user-123")
# Returns a RaindropAzureOpenAI instance
Already using the Vercel AI SDK with Azure? The Vercel AI SDK integration automatically traces Azure OpenAI calls when you use the AI SDK’s Azure provider. This integration is for users calling the Azure OpenAI SDK directly.