> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbluejay.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI

> Trace OpenAI SDK calls.

`BluejayClient(tracing=True)` traces the OpenAI SDK. No extra package. Chat completions and responses are covered: `create`, `parse`, and `stream`, including Azure OpenAI and OpenAI-compatible clients.

```python Python icon="https://mintcdn.com/bluejay/73RDPPJpgHtl6PiO/logo/python.svg?fit=max&auto=format&n=73RDPPJpgHtl6PiO&q=85&s=ce56f186813559443f877804e7aef209" theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from bluejay import BluejayClient

client = BluejayClient(tracing=True)

# this call is a span, with the model, prompt, reply, tool calls, tokens, and finish reason
reply = openai_client.chat.completions.create(model="gpt-4o-mini", messages=messages)
```

```typescript TypeScript icon="https://mintcdn.com/bluejay/73RDPPJpgHtl6PiO/logo/typescript.svg?fit=max&auto=format&n=73RDPPJpgHtl6PiO&q=85&s=d4b45d3e44d76cf40cfb09b3d24831f5" theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { BluejayClient } from "@getbluejay/sdk";

const client = new BluejayClient({ tracing: true });
const { OpenAI } = await import("openai");
const openai = new OpenAI();

const reply = await openai.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello" }],
});
await client.flush();
```

When the call runs inside a [session](https://docs.getbluejay.ai/sdk/observability.md#trace-chat-or-sms), the span joins that call.

## Related

* [SDK](https://docs.getbluejay.ai/sdk/overview.md)
* [Traces](https://docs.getbluejay.ai/monitor/traces.md)

Node.js supports OpenAI versions 4.19 through 6.x. Initialize Bluejay before loading OpenAI. For ES modules, run Node with `--experimental-loader=@opentelemetry/instrumentation/hook.mjs` and dynamically import OpenAI after initialization.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.