A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.
C++
Add Requesty as a provider
Thibault Jaigu65d83c523ea0
diff --git a/macos/Core/Enums/ProviderType.swift b/macos/Core/Enums/ProviderType.swiftindex 4332b5a..bb8f3ec 100644--- a/macos/Core/Enums/ProviderType.swift+++ b/macos/Core/Enums/ProviderType.swift@@ -23,6 +23,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case xAI = "xai"case perplexitycase openRouter = "openrouter"+ case requestycase togethercase fireworkscase dashscope@@ -47,6 +48,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case .xAI: return "xAI (Grok)"case .perplexity: return "Perplexity"case .openRouter: return "OpenRouter"+ case .requesty: return "Requesty"case .together: return "Together AI"case .fireworks: return "Fireworks AI"case .dashscope: return "DashScope (Qwen)"@@ -63,7 +65,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case .ollama: return .localcase .chatGPT: return .subscriptioncase .openAI, .azureOpenAI, .groq, .deepseek, .mistral, .xAI,- .perplexity, .openRouter, .together, .fireworks, .dashscope,+ .perplexity, .openRouter, .requesty, .together, .fireworks, .dashscope,.dashscopeCoding, .openAICompatible:return .openAICompat}@@ -91,6 +93,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case .xAI: return "https://api.x.ai/v1"case .perplexity: return "https://api.perplexity.ai"case .openRouter: return "https://openrouter.ai/api/v1"+ case .requesty: return "https://router.requesty.ai/v1"case .together: return "https://api.together.xyz/v1"case .fireworks: return "https://api.fireworks.ai/inference/v1"case .dashscope: return "https://dashscope.aliyuncs.com/compatible-mode/v1"@@ -113,6 +116,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case .xAI: return "grok-2-latest"case .perplexity: return "llama-3.1-sonar-large-128k-online"case .openRouter: return "anthropic/claude-sonnet-4"+ case .requesty: return "openai/gpt-4o-mini"case .together: return "meta-llama/Llama-3.3-70B-Instruct-Turbo"case .fireworks: return "accounts/fireworks/models/llama-v3p3-70b-instruct"case .dashscope: return "qwen-plus"@@ -155,6 +159,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case .xAI: return "x.circle.fill"case .perplexity: return "questionmark.circle.fill"case .openRouter: return "arrow.triangle.branch"+ case .requesty: return "arrow.triangle.branch"case .together: return "person.2.fill"case .fireworks: return "sparkles"case .dashscope: return "cpu.fill"@@ -181,6 +186,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {case .xAI: return ["grok-2-latest", "grok-2-vision-latest"]case .perplexity: return ["llama-3.1-sonar-large-128k-online", "llama-3.1-sonar-small-128k-online"]case .openRouter: return ["anthropic/claude-sonnet-4", "openai/gpt-4o", "meta-llama/llama-3.3-70b"]+ case .requesty: return ["openai/gpt-4o-mini", "openai/gpt-4o", "anthropic/claude-sonnet-4-5", "google/gemini-2.5-flash", "deepseek/deepseek-chat"]case .together: return ["meta-llama/Llama-3.3-70B-Instruct-Turbo", "mistralai/Mixtral-8x7B-Instruct-v0.1"]case .fireworks: return ["accounts/fireworks/models/llama-v3p3-70b-instruct"]case .dashscope:diff --git a/macos/Services/AI/ProviderFactory.swift b/macos/Services/AI/ProviderFactory.swiftindex 1c9f209..36e6de3 100644--- a/macos/Services/AI/ProviderFactory.swift+++ b/macos/Services/AI/ProviderFactory.swift@@ -40,7 +40,7 @@ enum ProviderFactory {}return ChatGPTProvider(providerId: config.id, baseURL: base, oauthService: svc)case .openAI, .azureOpenAI, .groq, .deepseek, .mistral, .xAI,- .perplexity, .openRouter, .together, .fireworks, .dashscope,+ .perplexity, .openRouter, .requesty, .together, .fireworks, .dashscope,.dashscopeCoding, .openAICompatible:return OpenAIProvider(apiKey: apiKey, baseURL: base, probeModel: config.model)}diff --git a/windows/Gridex/AiService.cpp b/windows/Gridex/AiService.cppindex 84d21f3..8a0541e 100644--- a/windows/Gridex/AiService.cpp+++ b/windows/Gridex/AiService.cpp@@ -137,6 +137,7 @@ namespace DBModelscase AiProvider::Gemini: return CallGemini(messages, systemPrompt);case AiProvider::OpenRouter: return CallOpenRouter(messages, systemPrompt);case AiProvider::ChatGPT: return CallChatGPT(messages, systemPrompt);+ case AiProvider::Requesty: return CallRequesty(messages, systemPrompt);default: return L"Unsupported AI provider";}}@@ -491,6 +492,74 @@ namespace DBModelsreturn L"No response content";}+ // ── Requesty chat completions ──────────────────+ //+ // Requesty is OpenAI-protocol-compatible (base https://router.requesty.ai/v1),+ // so the request/response shapes are identical to CallOpenRouter — only the+ // host and path differ. Auth is a standard Authorization: Bearer key.+ std::wstring AiService::CallRequesty(+ const std::vector<ChatMessage>& messages,+ const std::wstring& systemPrompt)+ {+ httplib::Client cli("https://router.requesty.ai");+ cli.set_connection_timeout(30);+ cli.set_read_timeout(60);++ auto apiKey = trimWs(config_.apiKey);+ if (apiKey.empty())+ return L"Error: Requesty API key is missing. Set it in Settings.";++ nlohmann::json body;+ auto model = trimWs(config_.model);+ // Requesty requires a fully-qualified model slug like+ // "openai/gpt-4o" or "anthropic/claude-sonnet-4-5". Pick a sane+ // default that's cheap and always available.+ body["model"] = toUtf8(model.empty() ? L"openai/gpt-4o-mini" : model);+ body["max_tokens"] = 2048;++ nlohmann::json msgs = nlohmann::json::array();+ if (!systemPrompt.empty())+ {+ nlohmann::json sysMsg;+ sysMsg["role"] = "system";+ sysMsg["content"] = toUtf8(systemPrompt);+ msgs.push_back(sysMsg);+ }+ for (auto& m : messages)+ {+ nlohmann::json msg;+ msg["role"] = toUtf8(m.role);+ msg["content"] = toUtf8(m.content);+ msgs.push_back(msg);+ }+ body["messages"] = msgs;++ httplib::Headers headers = {+ {"Authorization", "Bearer " + toUtf8(apiKey)}+ };++ auto res = cli.Post("/v1/chat/completions", headers,+ body.dump(), "application/json");+ if (!res)+ return L"Error: Failed to connect to Requesty API";++ if (res->status != 200)+ return fromUtf8("Error " + std::to_string(res->status) ++ " (model=" + toUtf8(model) + "): " + res->body);++ try+ {+ auto json = nlohmann::json::parse(res->body);+ if (json.contains("choices") && !json["choices"].empty())+ return fromUtf8(json["choices"][0]["message"]["content"].get<std::string>());+ }+ catch (const std::exception& e)+ {+ return fromUtf8(std::string("Parse error: ") + e.what());+ }+ return L"No response content";+ }+// ── ChatGPT Subscription (Codex Responses API) ─────//// Uses OAuth bearer token from ChatGPT::OAuthService.@@ -816,6 +885,38 @@ namespace DBModelsbreak;}+ case AiProvider::Requesty:+ {+ // Requesty is OpenAI-compatible; its /v1/models listing+ // mirrors OpenRouter's shape ({"data":[{"id":...}]}).+ // Pass the API key when present for attribution.+ httplib::Client cli("https://router.requesty.ai");+ cli.set_connection_timeout(15);+ cli.set_read_timeout(30);+ httplib::Headers headers;+ if (!apiKey.empty())+ headers.emplace("Authorization", "Bearer " + toUtf8(apiKey));+ auto res = cli.Get("/v1/models", headers);+ if (!res)+ {+ r.errorMessage = L"Requesty models request failed (no response).";+ return r;+ }+ if (res->status != 200)+ {+ r.errorMessage = fromUtf8("HTTP " + std::to_string(res->status) + ": " + res->body);+ return r;+ }+ auto json = nlohmann::json::parse(res->body);+ if (json.contains("data") && json["data"].is_array())+ {+ for (auto& m : json["data"])+ if (m.contains("id"))+ r.models.push_back(fromUtf8(m["id"].get<std::string>()));+ }+ break;+ }+case AiProvider::ChatGPT:{// GET https://chatgpt.com/backend-api/codex/models with bearer token.diff --git a/windows/Gridex/Models/AiService.h b/windows/Gridex/Models/AiService.hindex d873e15..b927b25 100644--- a/windows/Gridex/Models/AiService.h+++ b/windows/Gridex/Models/AiService.h@@ -17,6 +17,7 @@ namespace DBModelsGemini = 3,OpenRouter = 4,ChatGPT = 5, // Subscription-based via OAuth (no API key)+ Requesty = 6, // OpenAI-compatible router (https://router.requesty.ai/v1)};struct AiConfig@@ -89,6 +90,9 @@ namespace DBModelsstd::wstring CallOpenRouter(const std::vector<ChatMessage>& messages,const std::wstring& systemPrompt);+ std::wstring CallRequesty(+ const std::vector<ChatMessage>& messages,+ const std::wstring& systemPrompt);std::wstring CallChatGPT(const std::vector<ChatMessage>& messages,const std::wstring& systemPrompt);diff --git a/windows/Gridex/SettingsPage.cpp b/windows/Gridex/SettingsPage.cppindex 13be115..2c46e33 100644--- a/windows/Gridex/SettingsPage.cpp+++ b/windows/Gridex/SettingsPage.cpp@@ -52,7 +52,7 @@ namespace winrt::Gridex::implementation// Helper: show/hide provider-specific panels (API key /// OAuth sign-in / Ollama endpoint) based on selection.// Indices: 0 Anthropic, 1 OpenAI, 2 Ollama, 3 Gemini,- // 4 OpenRouter, 5 ChatGPT.+ // 4 OpenRouter, 5 ChatGPT, 6 Requesty.auto updateProviderUI = [this](){int idx = AiProviderCombo().SelectedIndex();diff --git a/windows/Gridex/SettingsPage.xaml b/windows/Gridex/SettingsPage.xamlindex 5ae512f..97d9f96 100644--- a/windows/Gridex/SettingsPage.xaml+++ b/windows/Gridex/SettingsPage.xaml@@ -89,6 +89,7 @@<ComboBoxItem Content="Google Gemini" /><ComboBoxItem Content="OpenRouter" /><ComboBoxItem Content="OpenAI (Sign in)" />+ <ComboBoxItem Content="Requesty" /></ComboBox></StackPanel>