SPB Git

spb/zyquo-agent Public MIT

The autonomous agent that actually operates your Mac — plans, runs real commands, verifies its own work.

Swift 94.7% Shell 4.1% Python 0.7% Makefile 0.5%
3.2 KB · 97 lines swift
Raw Blame History
1//2//  ProviderID.swift3//  Zyquo Agent4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  Ported verbatim from Zyquo Cloud — same providers, same base URLs, same9//  wire formats. See docs/PROVIDER-REUSE.md.10//1112import Foundation1314/// The 12 built-in cloud AI providers, plus user-defined custom endpoints.15enum ProviderID: String, Codable, CaseIterable, Identifiable, Hashable {16    case openai17    case anthropic18    case xai19    case mistral20    case gemini21    case qwen22    case deepseek23    case kimi24    case perplexity25    case together26    case deepinfra27    case cerebras28    case custom2930    var id: String { rawValue }3132    /// User-facing display name.33    var displayName: String {34        switch self {35        case .openai: return "OpenAI"36        case .anthropic: return "Anthropic"37        case .xai: return "xAI"38        case .mistral: return "Mistral"39        case .gemini: return "Google Gemini"40        case .qwen: return "Alibaba Qwen"41        case .deepseek: return "DeepSeek"42        case .kimi: return "Kimi"43        case .perplexity: return "Perplexity"44        case .together: return "Together AI"45        case .deepinfra: return "DeepInfra"46        case .cerebras: return "Cerebras"47        case .custom: return "Custom"48        }49    }5051    /// Wire protocol used by this provider's chat endpoint.52    var wireFormat: WireFormat {53        switch self {54        case .anthropic: return .anthropicMessages55        default: return .openAIChatCompletions56        }57    }5859    /// Base URL of the provider's API (chat + models live under this root).60    /// `custom` has no fixed base URL — it comes from the user's endpoint config.61    var defaultBaseURL: URL? {62        switch self {63        case .openai: return URL(string: "https://api.openai.com/v1")64        case .anthropic: return URL(string: "https://api.anthropic.com/v1")65        case .xai: return URL(string: "https://api.x.ai/v1")66        case .mistral: return URL(string: "https://api.mistral.ai/v1")67        case .gemini: return URL(string: "https://generativelanguage.googleapis.com/v1beta/openai")68        case .qwen: return URL(string: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1")69        case .deepseek: return URL(string: "https://api.deepseek.com")70        case .kimi: return URL(string: "https://api.moonshot.ai/v1")71        case .perplexity: return URL(string: "https://api.perplexity.ai")72        case .together: return URL(string: "https://api.together.xyz/v1")73        case .deepinfra: return URL(string: "https://api.deepinfra.com/v1/openai")74        case .cerebras: return URL(string: "https://api.cerebras.ai/v1")75        case .custom: return nil76        }77    }7879    /// Whether the provider exposes a `/models` listing endpoint usable for dynamic refresh.80    var supportsModelListing: Bool {81        self != .perplexity82    }8384    /// Providers shown in Settings (custom endpoints are managed separately).85    static var builtIn: [ProviderID] {86        allCases.filter { $0 != .custom }87    }88}8990/// The request/response schema a provider speaks.91enum WireFormat: String, Codable {92    /// OpenAI `/chat/completions` schema (used by 11 of the 12 built-in providers).93    case openAIChatCompletions94    /// Anthropic `/v1/messages` schema.95    case anthropicMessages96}97