Peter Steinbergerfeat: add config-backed cli output8a8517310 months agoHistory
29 lines · 898 B · 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 .kimik2:            if let key = KimiK2SettingsReader.apiKeyEnvironmentKeys.first {                env[key] = apiKey            }        case .synthetic:            env[SyntheticSettingsReader.apiKeyKey] = 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