MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / openai

Function openai

packages/ai/src/providers.ts:28–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27let _openai: ReturnType<typeof createOpenAI> | null = null;
28function openai() {
29 if (!_openai) {
30 const {
31 OPENAI_API_KEY,
32 OPENAI_BASE_URL,
33 OPENAI_PROJECT,
34 OPENAI_ORGANIZATION,
35 } = openAiEnvSchema.parse(process.env);
36
37 if (!OPENAI_API_KEY) {
38 console.warn(
39 `[chat] OPENAI_API_KEY is not set. Models routed through OpenAI will fail with "x-api-key required" until you add it to the API's env.`
40 );
41 }
42
43 _openai = createOpenAI({
44 apiKey: OPENAI_API_KEY,
45 baseURL: OPENAI_BASE_URL,
46 project: OPENAI_PROJECT,
47 organization: OPENAI_ORGANIZATION,
48 });
49 }
50 return _openai;
51}
52
53let _anthropic: ReturnType<typeof createAnthropic> | null = null;
54function anthropic() {

Callers 1

resolveModelFunction · 0.85

Calls 2

parseMethod · 0.80
warnMethod · 0.45

Tested by

no test coverage detected