File size: 346 Bytes
65567a2
2f65818
35d05d3
2d85080
 
 
 
 
 
2f65818
1
2
3
4
5
6
7
8
9
10
11
import { Configuration, OpenAIApi } from "openai";

export const createClient = (apiKey: string): OpenAIApi => {
	const configuration = new Configuration({ apiKey });

	// See https://github.com/openai/openai-node/issues/6#issuecomment-1492814621
	delete configuration.baseOptions.headers["User-Agent"];

	return new OpenAIApi(configuration);
};