Skip to content

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 Opper as a provider

Felix Wunderlich884af2d1b49f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 870d626..244295e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ All notable changes to Gridex are documented in this file. Gridex ships native a
## [Unreleased]
### Added
+- **Opper AI provider**: Opper (`https://api.opper.ai/v3/compat`) is available as an OpenAI-compatible AI provider on macOS and Windows, next to OpenRouter and Requesty.
- **Redis namespace key tree (macOS)** — Redis keys can be browsed as a collapsible sidebar tree using a local configurable delimiter (default `:`). Leaf keys open the existing detail view; the flat SCAN-filtered key list remains available.
### Fixed
diff --git a/macos/Core/Enums/ProviderType.swift b/macos/Core/Enums/ProviderType.swift
index bb8f3ec..a600115 100644
--- a/macos/Core/Enums/ProviderType.swift
+++ b/macos/Core/Enums/ProviderType.swift
@@ -24,6 +24,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
case perplexity
case openRouter = "openrouter"
case requesty
+ case opper
case together
case fireworks
case dashscope
@@ -49,6 +50,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
case .perplexity: return "Perplexity"
case .openRouter: return "OpenRouter"
case .requesty: return "Requesty"
+ case .opper: return "Opper"
case .together: return "Together AI"
case .fireworks: return "Fireworks AI"
case .dashscope: return "DashScope (Qwen)"
@@ -65,7 +67,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
case .ollama: return .local
case .chatGPT: return .subscription
case .openAI, .azureOpenAI, .groq, .deepseek, .mistral, .xAI,
- .perplexity, .openRouter, .requesty, .together, .fireworks, .dashscope,
+ .perplexity, .openRouter, .requesty, .opper, .together, .fireworks, .dashscope,
.dashscopeCoding, .openAICompatible:
return .openAICompat
}
@@ -94,6 +96,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
case .perplexity: return "https://api.perplexity.ai"
case .openRouter: return "https://openrouter.ai/api/v1"
case .requesty: return "https://router.requesty.ai/v1"
+ case .opper: return "https://api.opper.ai/v3/compat"
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"
@@ -117,6 +120,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
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 .opper: return "claude-sonnet-4-6"
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"
@@ -160,6 +164,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
case .perplexity: return "questionmark.circle.fill"
case .openRouter: return "arrow.triangle.branch"
case .requesty: return "arrow.triangle.branch"
+ case .opper: return "arrow.triangle.branch"
case .together: return "person.2.fill"
case .fireworks: return "sparkles"
case .dashscope: return "cpu.fill"
@@ -187,6 +192,7 @@ enum ProviderType: String, Codable, Sendable, CaseIterable, Identifiable {
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 .opper: return ["claude-sonnet-4-6", "gpt-5.5", "gemini-3.8-flash", "gpt-5.4-mini", "deepseek-v4-pro"]
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.swift
index 36e6de3..3824ff0 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, .requesty, .together, .fireworks, .dashscope,
+ .perplexity, .openRouter, .requesty, .opper, .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.cpp
index 8a0541e..42b5148 100644
--- a/windows/Gridex/AiService.cpp
+++ b/windows/Gridex/AiService.cpp
@@ -138,6 +138,7 @@ namespace DBModels
case AiProvider::OpenRouter: return CallOpenRouter(messages, systemPrompt);
case AiProvider::ChatGPT: return CallChatGPT(messages, systemPrompt);
case AiProvider::Requesty: return CallRequesty(messages, systemPrompt);
+ case AiProvider::Opper: return CallOpper(messages, systemPrompt);
default: return L"Unsupported AI provider";
}
}
@@ -560,6 +561,72 @@ namespace DBModels
return L"No response content";
}
+ // Opper chat completions
+ //
+ // Opper is OpenAI-protocol-compatible (base https://api.opper.ai/v3/compat),
+ // so the request/response shapes are the same as CallRequesty; only the
+ // host and path differ. Model ids are bare pool names such as
+ // "claude-sonnet-4-6". Auth is a standard Authorization: Bearer key.
+ std::wstring AiService::CallOpper(
+ const std::vector<ChatMessage>& messages,
+ const std::wstring& systemPrompt)
+ {
+ httplib::Client cli("https://api.opper.ai");
+ cli.set_connection_timeout(30);
+ cli.set_read_timeout(60);
+
+ auto apiKey = trimWs(config_.apiKey);
+ if (apiKey.empty())
+ return L"Error: Opper API key is missing. Set it in Settings.";
+
+ nlohmann::json body;
+ auto model = trimWs(config_.model);
+ body["model"] = toUtf8(model.empty() ? L"claude-sonnet-4-6" : 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("/v3/compat/chat/completions", headers,
+ body.dump(), "application/json");
+ if (!res)
+ return L"Error: Failed to connect to Opper 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.
@@ -917,6 +984,37 @@ namespace DBModels
break;
}
+ case AiProvider::Opper:
+ {
+ // Opper's /v3/compat/models listing has the OpenAI shape
+ // ({"data":[{"id":...}]}) and needs the API key.
+ httplib::Client cli("https://api.opper.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("/v3/compat/models", headers);
+ if (!res)
+ {
+ r.errorMessage = L"Opper 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.h
index b927b25..d130d50 100644
--- a/windows/Gridex/Models/AiService.h
+++ b/windows/Gridex/Models/AiService.h
@@ -18,6 +18,7 @@ namespace DBModels
OpenRouter = 4,
ChatGPT = 5, // Subscription-based via OAuth (no API key)
Requesty = 6, // OpenAI-compatible router (https://router.requesty.ai/v1)
+ Opper = 7, // OpenAI-compatible gateway (https://api.opper.ai/v3/compat)
};
struct AiConfig
@@ -93,6 +94,9 @@ namespace DBModels
std::wstring CallRequesty(
const std::vector<ChatMessage>& messages,
const std::wstring& systemPrompt);
+ std::wstring CallOpper(
+ 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.cpp
index 2c46e33..8828cf4 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, 6 Requesty.
+ // 4 OpenRouter, 5 ChatGPT, 6 Requesty, 7 Opper.
auto updateProviderUI = [this]()
{
int idx = AiProviderCombo().SelectedIndex();
diff --git a/windows/Gridex/SettingsPage.xaml b/windows/Gridex/SettingsPage.xaml
index 97d9f96..3013286 100644
--- a/windows/Gridex/SettingsPage.xaml
+++ b/windows/Gridex/SettingsPage.xaml
@@ -90,6 +90,7 @@
<ComboBoxItem Content="OpenRouter" />
<ComboBoxItem Content="OpenAI (Sign in)" />
<ComboBoxItem Content="Requesty" />
+ <ComboBoxItem Content="Opper" />
</ComboBox>
</StackPanel>