Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/Service/OpenAiAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ public function isUsingOpenAi(): bool {
return $serviceUrl === '' || $serviceUrl === Application::OPENAI_API_BASE_URL;
}

/**
* @return bool
*/
public function isUsingOpenRouter(): bool {
$serviceUrl = $this->openAiSettingsService->getServiceUrl();
// Return true if the service URL references OpenRouter (e.g., openrouter.ai)
return str_starts_with(strtolower($serviceUrl), 'https://openrouter.ai');
}

/**
* @return string
*/
Expand Down Expand Up @@ -177,7 +186,8 @@ public function getModels(?string $userId, bool $refresh = false): array {

try {
$this->logger->debug('Actually getting OpenAI models with a network request');
$modelsResponse = $this->request($userId, 'models');
$params = $this->isUsingOpenRouter() ? ['output_modalities' => 'all'] : [];
$modelsResponse = $this->request($userId, 'models', $params);
} catch (Exception $e) {
$this->logger->warning('Error retrieving models (exc): ' . $e->getMessage());
throw $e;
Expand Down
Loading