Skip to main content
This page shows how to capture Azure OpenAI Service traffic with Moda. The Python SDK captures calls made with the AzureOpenAI client automatically and records the provider as Azure, detected from the endpoint URL. The Node.js SDK does not auto-instrument Azure OpenAI — see Node.js support for alternatives.

Prerequisites

  • A Moda API key (created in the dashboard at Settings → Ingestion keys; shown once at creation)
  • An Azure OpenAI resource with a model deployment, its API key, and its endpoint URL
  • Python 3.10 or later

Setup (Python)

1

Install the packages

pip
2

Initialize Moda before creating the client

Initialize the SDK first, then construct the AzureOpenAI client. Flush before your process exits so buffered data is sent.
app.py
With Azure OpenAI, the model parameter is your deployment name, not the underlying model name. Moda records the value you pass as the model identifier.
3

Verify in the dashboard

Run the script, then open Conversations in the dashboard. You should see a conversation with ID session_123 containing the user message and the assistant reply. The recorded model is your deployment name, and the provider is recorded as Azure.

Streaming and tool use (Python)

The AzureOpenAI client uses the same chat completions and embeddings classes as the standard OpenAI client, so Azure calls go through the same instrumentation — streaming, tool use, and embeddings are captured through the same code paths, and only the client constructor differs. The SDK records streaming responses after the stream finishes, so consume the entire stream. See the OpenAI streaming and tool use examples; replace the client with AzureOpenAI and the model with your deployment name.

Node.js support

The Moda SDK for Node.js does not auto-instrument the Azure OpenAI client. To capture Azure OpenAI traffic from a Node.js app, use one of:
  • OpenTelemetry — export GenAI spans from your existing OTel setup to Moda’s OTLP endpoint.
  • HTTP API — send conversation events directly with a simple JSON payload.
  • Moda.withLLMCall() — wrap the Azure call manually and report the request and response yourself; see the Node.js SDK.

Support matrix

Troubleshooting

The model field shows a deployment name instead of a model name. Expected — Azure OpenAI addresses models by deployment name, and Moda records the identifier you pass. No conversations appear in the dashboard. Initialize Moda before constructing the AzureOpenAI client, and call moda.flush() before the process exits. Confirm the Moda API key starts with moda_sk_. Authentication errors from Azure. Verify api_key, api_version, and azure_endpoint, and confirm the deployment exists in your Azure OpenAI resource. These errors come from Azure, not from Moda.

Next steps

  • OpenAI — full coverage details for the shared OpenAI instrumentation.
  • Python SDK — init options, context managers, and instrument controls.
  • OpenTelemetry — the recommended path for Azure OpenAI from Node.js.
  • HTTP API — send events directly from any language.