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

# wrapOpenAI

> TypeScript SDK reference

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

Defined in: [src/integrations/openai.ts:723](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/openai.ts#L723)

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

## Type Parameters

### T

`T` *extends* `OpenAIAPI`

## 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!' }]
});
```
