mirror of
https://github.com/Gitlawb/openclaude.git
synced 2026-11-06 12:50:54 -04:00
fix(requesty): give a Requesty teammate override its own key
Teammates now inherit REQUESTY_API_KEY, and Requesty prefers it over OPENAI_API_KEY. applyAgentProviderOverrideToEnv cleared and replaced the dedicated keys of Merge, OrcaRouter, Runcrate and Command Code, but not Requesty, so an agentModels Requesty override kept using the parent's key. Clear it for every override and install the configured key for a canonical Requesty endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -892,3 +892,20 @@ test.each([undefined, 'parent-orca-key'])(
|
|||||||
expect(env.OPENAI_API_KEY).toBe('custom-key')
|
expect(env.OPENAI_API_KEY).toBe('custom-key')
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
test.each([undefined, 'parent-requesty-key'])(
|
||||||
|
'spawned Requesty override owns its key with ambient %s', ambient => {
|
||||||
|
const env: NodeJS.ProcessEnv = { REQUESTY_API_KEY: ambient }
|
||||||
|
applyAgentProviderOverrideToEnv({
|
||||||
|
model: 'openai/gpt-5-mini', baseURL: 'https://router.requesty.ai/v1',
|
||||||
|
apiKey: 'configured-agent-key',
|
||||||
|
}, env)
|
||||||
|
expect(env.REQUESTY_API_KEY).toBe('configured-agent-key')
|
||||||
|
expect(env.OPENAI_API_KEY).toBe('configured-agent-key')
|
||||||
|
applyAgentProviderOverrideToEnv({
|
||||||
|
model: 'custom', baseURL: 'https://custom.example/v1', apiKey: 'custom-key',
|
||||||
|
}, env)
|
||||||
|
expect(env.REQUESTY_API_KEY).toBeUndefined()
|
||||||
|
expect(env.OPENAI_API_KEY).toBe('custom-key')
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const PROVIDER_ENV_VARS_TO_CLEAR_FOR_OVERRIDE = [
|
|||||||
'OPENAI_AUTH_SCHEME',
|
'OPENAI_AUTH_SCHEME',
|
||||||
'OPENAI_AUTH_HEADER_VALUE',
|
'OPENAI_AUTH_HEADER_VALUE',
|
||||||
'MERGE_GATEWAY_API_KEY',
|
'MERGE_GATEWAY_API_KEY',
|
||||||
|
'REQUESTY_API_KEY',
|
||||||
'ORCAROUTER_API_KEY',
|
'ORCAROUTER_API_KEY',
|
||||||
'RUNCRATE_API_KEY',
|
'RUNCRATE_API_KEY',
|
||||||
'CMD_API_KEY',
|
'CMD_API_KEY',
|
||||||
@@ -380,4 +381,8 @@ export function applyAgentProviderOverrideToEnv(
|
|||||||
if (resolveRouteIdFromBaseUrl(providerOverride.baseURL) === 'commandcode') {
|
if (resolveRouteIdFromBaseUrl(providerOverride.baseURL) === 'commandcode') {
|
||||||
env.CMD_API_KEY = providerOverride.apiKey
|
env.CMD_API_KEY = providerOverride.apiKey
|
||||||
}
|
}
|
||||||
|
if (resolveRouteIdFromBaseUrl(providerOverride.baseURL) === 'requesty') {
|
||||||
|
const key = sanitizeApiKey(providerOverride.apiKey)
|
||||||
|
if (key) env.REQUESTY_API_KEY = key
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user