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

Function getGrokApiKeyFromEnv

packages/ai-grok/src/utils/client.ts:12–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 * @throws Error if XAI_API_KEY is not found
11 */
12export function getGrokApiKeyFromEnv(): string {
13 try {
14 return getApiKeyFromEnv('XAI_API_KEY')
15 } catch {
16 throw new Error(
17 'XAI_API_KEY is required. Please set it in your environment variables or use the factory function with an explicit API key.',
18 )
19 }
20}
21
22/**
23 * Returns a Grok client config with the default xAI base URL applied

Callers 7

grokTextFunction · 0.90
grokVideoFunction · 0.90
grokTranscriptionFunction · 0.90
grokSummarizeFunction · 0.90
grokImageFunction · 0.90
grokSpeechFunction · 0.90
grokRealtimeTokenFunction · 0.90

Calls 1

getApiKeyFromEnvFunction · 0.90

Tested by

no test coverage detected