MCPcopy Create free account
hub / github.com/TanStack/ai / getOpenAIModel

Function getOpenAIModel

examples/ts-react-native-chat/src/server/app.ts:95–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93}
94
95function getOpenAIModel(): OpenAIChatModel {
96 const configuredModel = process.env.OPENAI_MODEL ?? DEFAULT_OPENAI_MODEL
97 if (!isOpenAIChatModel(configuredModel)) {
98 throw new Error(
99 `OPENAI_MODEL must be one of the known @tanstack/ai-openai chat models. Received: ${configuredModel}`,
100 )
101 }
102 return configuredModel
103}
104
105function requireOpenAIApiKey(): string {
106 const apiKey = process.env.OPENAI_API_KEY

Callers 1

createChatStreamFunction · 0.85

Calls 1

isOpenAIChatModelFunction · 0.85

Tested by

no test coverage detected