Add OpenRouter user agent identification headers (#241)

Addresses GitHub issue #240 by adding proper application identification
when using OpenRouter API. This ensures the application appears as
"AI Marketplace Monitor" in OpenRouter's dashboard instead of "Unknown"
and provides a direct link to the GitHub repository.

- Added X-Title header with application name
- Added HTTP-Referer header with repository URL
- Follows OpenRouter's recommended identification practices
This commit is contained in:
adawalli
2025-08-03 21:59:46 -04:00
committed by GitHub
parent c8a7d0453d
commit 941d11c1a5

View File

@@ -255,6 +255,10 @@ class OpenAIBackend(AIBackend):
api_key=self.config.api_key,
base_url=self.config.base_url or self.base_url,
timeout=self.config.timeout,
default_headers={
"X-Title": "AI Marketplace Monitor",
"HTTP-Referer": "https://github.com/BoPeng/ai-marketplace-monitor",
},
)
if self.logger:
self.logger.info(f"""{hilight("[AI]", "name")} {self.config.name} connected.""")