> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-1778-mysql-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# wrapOpenAI

> TypeScript SDK reference

# wrapOpenAI

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

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

#### Type parameters

| Name | Type                |
| :--- | :------------------ |
| `T`  | extends `OpenAIAPI` |

#### Parameters

| Name     | Type |
| :------- | :--- |
| `openai` | `T`  |

#### Returns

`T`

`Example`

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

#### Defined in

[integrations/openai.ts:469](https://github.com/wandb/weave/blob/5d9590d2658eeb69c9c9f04342e107bf9a0a4c90/sdks/node/src/integrations/openai.ts#L469)
