39 lines · 1.3 KB · Swift
RawDownload
import Foundation public enum ProviderConfigEnvironment {    public static func applyAPIKeyOverride(        base: [String: String],        provider: UsageProvider,        config: ProviderConfig?) -> [String: String]    {        guard let apiKey = config?.sanitizedAPIKey, !apiKey.isEmpty else { return base }        var env = base        switch provider {        case .zai:            env[ZaiSettingsReader.apiTokenKey] = apiKey        case .copilot:            env["COPILOT_API_TOKEN"] = apiKey        case .minimax:            env[MiniMaxAPISettingsReader.apiTokenKey] = apiKey        case .alibaba:            env[AlibabaCodingPlanSettingsReader.apiTokenKey] = apiKey        case .kilo:            env[KiloSettingsReader.apiTokenKey] = apiKey        case .kimik2:            if let key = KimiK2SettingsReader.apiKeyEnvironmentKeys.first {                env[key] = apiKey            }        case .synthetic:            env[SyntheticSettingsReader.apiKeyKey] = apiKey        case .warp:            if let key = WarpSettingsReader.apiKeyEnvironmentKeys.first {                env[key] = apiKey            }        case .openrouter:            env[OpenRouterSettingsReader.envKey] = apiKey        default:            break        }        return env    }}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t