MCPcopy Index your code
hub / github.com/coder/coder / missingProviderAPIKeyError

Function missingProviderAPIKeyError

coderd/x/chatd/chatprovider/chatprovider.go:1334–1353  ·  view source on GitHub ↗

Providers that allow ambient credentials, such as Bedrock, bypass this helper only after ResolveUserProviderKeys marks them available.

(provider string)

Source from the content-addressed store, hash-verified

1332// this helper only after ResolveUserProviderKeys marks them
1333// available.
1334func missingProviderAPIKeyError(provider string) error {
1335 switch provider {
1336 case fantasyanthropic.Name:
1337 return xerrors.New("ANTHROPIC_API_KEY is not set")
1338 case fantasyazure.Name:
1339 return xerrors.New("AZURE_OPENAI_API_KEY is not set")
1340 case fantasygoogle.Name:
1341 return xerrors.New("GOOGLE_API_KEY is not set")
1342 case fantasyopenai.Name:
1343 return xerrors.New("OPENAI_API_KEY is not set")
1344 case fantasyopenaicompat.Name:
1345 return xerrors.New("OPENAI_COMPAT_API_KEY is not set")
1346 case fantasyopenrouter.Name:
1347 return xerrors.New("OPENROUTER_API_KEY is not set")
1348 case fantasyvercel.Name:
1349 return xerrors.New("VERCEL_API_KEY is not set")
1350 default:
1351 return xerrors.Errorf("API key for provider %q is not set", provider)
1352 }
1353}
1354
1355// ProviderOptionsFromChatModelConfig converts chat model provider options to
1356// fantasy provider options used for inference calls.

Callers 1

ModelFromConfigFunction · 0.85

Calls 2

NewMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected