MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / getApiKeyByProvider

Function getApiKeyByProvider

packages/config/src/auth-profiles.ts:62–70  ·  view source on GitHub ↗
(provider: string)

Source from the content-addressed store, hash-verified

60 * 按 provider 名称获取 API Key(模糊匹配,取第一个匹配的 profile)
61 */
62export function getApiKeyByProvider(provider: string): string {
63 const data = loadAuthProfiles()
64 for (const profile of Object.values(data.profiles)) {
65 if (profile.provider === provider) {
66 return profile.key || ''
67 }
68 }
69 return ''
70}
71
72/**
73 * 查找 API Key:先按 authProfile 精确匹配,再按 provider 兜底

Callers 1

resolveApiKeyFunction · 0.85

Calls 1

loadAuthProfilesFunction · 0.85

Tested by

no test coverage detected