-
Notifications
You must be signed in to change notification settings - Fork 1
[EVAL] API key from Env Var support #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8d5d4f8
9391ede
fa0504f
39a1edb
91725fd
742ca14
4fb7ed7
891af6d
488ac44
910028d
436025f
e17c2e6
7e518b1
78598db
2f5e00f
60002d8
2b6b2ea
f154eb2
674055c
88d587f
1ea534c
5706600
6f8b0d9
f9c6a51
2ff6dec
895b505
11fe352
08e7d73
0879bcd
0231f6f
0707083
e711534
6f7cace
ce8186d
010300c
91206b1
1076c2a
8dd02bc
6b82ada
c0f82d8
8868930
86fd178
b39fdb9
bfe5486
2fd04c5
b2ef23c
6b32481
09dad33
2391628
95fbe97
5ec88ba
4736894
cc85602
d6f301f
4d20fac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /** | ||
| * API key environment variable names organized by provider | ||
| */ | ||
| export const API_KEYS = { | ||
| ANTHROPIC: 'ANTHROPIC_API_KEY', | ||
| OPENAI: 'OPENAI_API_KEY', | ||
| OPEN_ROUTER: 'OPENROUTER_API_KEY', | ||
| GLAMA: 'GLAMA_API_KEY', | ||
| GEMINI: 'GEMINI_API_KEY', | ||
| MISTRAL: 'MISTRAL_API_KEY', | ||
| DEEP_SEEK: 'DEEPSEEK_API_KEY', | ||
| UNBOUND: 'UNBOUND_API_KEY', | ||
| REQUESTY: 'REQUESTY_API_KEY', | ||
| XAI: 'XAI_API_KEY', | ||
| GROQ: 'GROQ_API_KEY', | ||
| CHUTES: 'CHUTES_API_KEY', | ||
| LITELLM: 'LITELLM_API_KEY', | ||
| CEREBRAS: 'CEREBRAS_API_KEY', | ||
| DEEP_INFRA: 'DEEPINFRA_API_KEY', | ||
| DOUBAO: 'DOUBAO_API_KEY', | ||
| FEATHERLESS: 'FEATHERLESS_API_KEY', | ||
| FIREWORKS: 'FIREWORKS_API_KEY', | ||
| HUGGING_FACE: 'HUGGINGFACE_API_KEY', | ||
| IO_INTELLIGENCE: 'IOINTELLIGENCE_API_KEY', | ||
| MOONSHOOT: 'MOONSHOT_API_KEY', | ||
| SAMBA_NOVA: 'SAMBANOVA_API_KEY', | ||
| VERCEL: 'VERCEL_API_KEY', | ||
| ZAI: 'ZAI_API_KEY', | ||
| } as const | ||
|
|
||
| /** | ||
| * Array of all API key environment variable names | ||
| */ | ||
| export const API_KEY_ENV_VAR_NAMES = Object.values(API_KEYS) | ||
|
|
||
| /** | ||
| * Type for API key environment variable names | ||
| */ | ||
| export type ApiKeyEnvVar = typeof API_KEYS[keyof typeof API_KEYS] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -190,6 +190,7 @@ const apiModelIdProviderModelSchema = baseProviderSettingsSchema.extend({ | |||||
|
|
||||||
| const anthropicSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| apiKey: z.string().optional(), | ||||||
| anthropicConfigUseEnvVars: z.boolean().optional(), | ||||||
| anthropicBaseUrl: z.string().optional(), | ||||||
| anthropicUseAuthToken: z.boolean().optional(), | ||||||
| anthropicBeta1MContext: z.boolean().optional(), // Enable 'context-1m-2025-08-07' beta for 1M context window. | ||||||
|
|
@@ -203,10 +204,12 @@ const claudeCodeSchema = apiModelIdProviderModelSchema.extend({ | |||||
| const glamaSchema = baseProviderSettingsSchema.extend({ | ||||||
| glamaModelId: z.string().optional(), | ||||||
| glamaApiKey: z.string().optional(), | ||||||
| glamaConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const openRouterSchema = baseProviderSettingsSchema.extend({ | ||||||
| openRouterApiKey: z.string().optional(), | ||||||
| openRouterConfigUseEnvVars: z.boolean().optional(), | ||||||
| openRouterModelId: z.string().optional(), | ||||||
| openRouterBaseUrl: z.string().optional(), | ||||||
| openRouterSpecificProvider: z.string().optional(), | ||||||
|
|
@@ -243,6 +246,7 @@ const vertexSchema = apiModelIdProviderModelSchema.extend({ | |||||
| const openAiSchema = baseProviderSettingsSchema.extend({ | ||||||
| openAiBaseUrl: z.string().optional(), | ||||||
| openAiApiKey: z.string().optional(), | ||||||
| openAiConfigUseEnvVars: z.boolean().optional(), | ||||||
| openAiLegacyFormat: z.boolean().optional(), | ||||||
| openAiR1FormatEnabled: z.boolean().optional(), | ||||||
| openAiModelId: z.string().optional(), | ||||||
|
|
@@ -281,6 +285,7 @@ const lmStudioSchema = baseProviderSettingsSchema.extend({ | |||||
|
|
||||||
| const geminiSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| geminiApiKey: z.string().optional(), | ||||||
| geminiConfigUseEnvVars: z.boolean().optional(), | ||||||
| googleGeminiBaseUrl: z.string().optional(), | ||||||
| enableUrlContext: z.boolean().optional(), | ||||||
| enableGrounding: z.boolean().optional(), | ||||||
|
|
@@ -293,6 +298,7 @@ const geminiCliSchema = apiModelIdProviderModelSchema.extend({ | |||||
|
|
||||||
| const openAiNativeSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| openAiNativeApiKey: z.string().optional(), | ||||||
| openAiNativeConfigUseEnvVars: z.boolean().optional(), | ||||||
| openAiNativeBaseUrl: z.string().optional(), | ||||||
| // OpenAI Responses API service tier for openai-native provider only. | ||||||
| // UI should only expose this when the selected model supports flex/priority. | ||||||
|
|
@@ -301,40 +307,47 @@ const openAiNativeSchema = apiModelIdProviderModelSchema.extend({ | |||||
|
|
||||||
| const mistralSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| mistralApiKey: z.string().optional(), | ||||||
| mistralConfigUseEnvVars: z.boolean().optional(), | ||||||
| mistralCodestralUrl: z.string().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const deepSeekSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| deepSeekBaseUrl: z.string().optional(), | ||||||
| deepSeekApiKey: z.string().optional(), | ||||||
| deepSeekConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const deepInfraSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| deepInfraBaseUrl: z.string().optional(), | ||||||
| deepInfraApiKey: z.string().optional(), | ||||||
| deepInfraConfigUseEnvVars: z.boolean().optional(), | ||||||
| deepInfraModelId: z.string().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const doubaoSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| doubaoBaseUrl: z.string().optional(), | ||||||
| doubaoApiKey: z.string().optional(), | ||||||
| doubaoConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const moonshotSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| moonshotBaseUrl: z | ||||||
| .union([z.literal("https://api.moonshot.ai/v1"), z.literal("https://api.moonshot.cn/v1")]) | ||||||
| .optional(), | ||||||
| moonshotApiKey: z.string().optional(), | ||||||
| moonshotConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const unboundSchema = baseProviderSettingsSchema.extend({ | ||||||
| unboundApiKey: z.string().optional(), | ||||||
| unboundConfigUseEnvVars: z.boolean().optional(), | ||||||
| unboundModelId: z.string().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const requestySchema = baseProviderSettingsSchema.extend({ | ||||||
| requestyBaseUrl: z.string().optional(), | ||||||
| requestyApiKey: z.string().optional(), | ||||||
| requestyConfigUseEnvVars: z.boolean().optional(), | ||||||
| requestyModelId: z.string().optional(), | ||||||
| }) | ||||||
|
|
||||||
|
|
@@ -346,35 +359,42 @@ const fakeAiSchema = baseProviderSettingsSchema.extend({ | |||||
|
|
||||||
| const xaiSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| xaiApiKey: z.string().optional(), | ||||||
| xaiConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const groqSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| groqApiKey: z.string().optional(), | ||||||
| groqConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const huggingFaceSchema = baseProviderSettingsSchema.extend({ | ||||||
| huggingFaceApiKey: z.string().optional(), | ||||||
| huggingFaceConfigUseEnvVars: z.boolean().optional(), | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespace after the comma. This should be removed for consistency with the rest of the file.
Suggested change
|
||||||
| huggingFaceModelId: z.string().optional(), | ||||||
| huggingFaceInferenceProvider: z.string().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const chutesSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| chutesApiKey: z.string().optional(), | ||||||
| chutesConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const litellmSchema = baseProviderSettingsSchema.extend({ | ||||||
| litellmBaseUrl: z.string().optional(), | ||||||
| litellmApiKey: z.string().optional(), | ||||||
| litellmConfigUseEnvVars: z.boolean().optional(), | ||||||
| litellmModelId: z.string().optional(), | ||||||
| litellmUsePromptCache: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const cerebrasSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| cerebrasApiKey: z.string().optional(), | ||||||
| cerebrasConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const sambaNovaSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| sambaNovaApiKey: z.string().optional(), | ||||||
| sambaNovaConfigUseEnvVars: z.boolean().optional(), | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespace after the comma. This should be removed for consistency.
Suggested change
|
||||||
| }) | ||||||
|
|
||||||
| export const zaiApiLineSchema = z.enum(["international_coding", "international", "china_coding", "china"]) | ||||||
|
|
@@ -383,20 +403,24 @@ export type ZaiApiLine = z.infer<typeof zaiApiLineSchema> | |||||
|
|
||||||
| const zaiSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| zaiApiKey: z.string().optional(), | ||||||
| zaiConfigUseEnvVars: z.boolean().optional(), | ||||||
| zaiApiLine: zaiApiLineSchema.optional(), | ||||||
| }) | ||||||
|
|
||||||
| const fireworksSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| fireworksApiKey: z.string().optional(), | ||||||
| fireworksConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const featherlessSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| featherlessApiKey: z.string().optional(), | ||||||
| featherlessConfigUseEnvVars: z.boolean().optional(), | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespace after the comma. This should be removed for consistency.
Suggested change
|
||||||
| }) | ||||||
|
|
||||||
| const ioIntelligenceSchema = apiModelIdProviderModelSchema.extend({ | ||||||
| ioIntelligenceModelId: z.string().optional(), | ||||||
| ioIntelligenceApiKey: z.string().optional(), | ||||||
| ioIntelligenceConfigUseEnvVars: z.boolean().optional(), | ||||||
| }) | ||||||
|
|
||||||
| const qwenCodeSchema = apiModelIdProviderModelSchema.extend({ | ||||||
|
|
@@ -409,6 +433,7 @@ const rooSchema = apiModelIdProviderModelSchema.extend({ | |||||
|
|
||||||
| const vercelAiGatewaySchema = baseProviderSettingsSchema.extend({ | ||||||
| vercelAiGatewayApiKey: z.string().optional(), | ||||||
| vercelConfigUseEnvVars: z.boolean().optional(), | ||||||
| vercelAiGatewayModelId: z.string().optional(), | ||||||
| }) | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in constant name:
MOONSHOOTshould beMOONSHOT(missing 'T'). This typo is then propagated to the usage inbuildApiHandlerat line 165.