Spaces:
Runtime error
Runtime error
File size: 468 Bytes
65567a2 2f65818 35d05d3 2d85080 2f65818 7288a2c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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);
};
export interface OpenAIError extends Error {
response?: {
data?: {
error?: {
message: string;
};
};
};
}
|