> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-drtangible-wip-test-inline-tag.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# wrapOpenAI

> TypeScript SDK reference

> **wrapOpenAI**\<`T`>(`openai`): `T`

Wraps the OpenAI API to enable function tracing for OpenAI calls.

Defined in: [src/integrations/openai.ts:760](https://github.com/wandb/weave/blob/7c9efdc9fe05ffcaf2430dd652ef9bc5b3ffdfaa/sdks/node/src/integrations/openai.ts#L760)

## Type Parameters

### T

`T` *extends* `object`

## Parameters

### openai

`T`

## Returns

`T`

## Example

```ts twoslash theme={null}
// @noErrors
const openai = wrapOpenAI(new OpenAI());
const result = await openai.chat.completions.create({
  model: 'gpt-3.5-turbo',
  messages: [{ role: 'user', content: 'Hello, world!' }]
});
```
