Problem
API requests from OpenAICompatibleProvider are blocked by Cloudflare-protected endpoints (e.g. OpenCode Go) with HTTP 403, error code 1010.
Root Cause
The _request_headers() method in echobot/providers/openai_compatible.py:380 does not include a User-Agent header. Cloudflare interprets the request as coming from an automated bot and blocks it.
Steps to Reproduce
- Configure
.env with a valid API key targeting any Cloudflare-protected OpenAI-compatible endpoint
- Start the bot
- Any LLM request fails with 401/403
Suggested Fix
Add a User-Agent header to the request headers:
def _request_headers(self) -> dict[str, str]:
return {
"Authorization": f"Bearer {self.settings.api_key}",
"Content-Type": "application/json; charset=utf-8",
"User-Agent": "EchoBot/1.0",
**self.settings.extra_headers,
}
This allows the request to pass Cloudflare's browser integrity check.
Problem
API requests from
OpenAICompatibleProviderare blocked by Cloudflare-protected endpoints (e.g. OpenCode Go) with HTTP 403, error code 1010.Root Cause
The
_request_headers()method inechobot/providers/openai_compatible.py:380does not include aUser-Agentheader. Cloudflare interprets the request as coming from an automated bot and blocks it.Steps to Reproduce
.envwith a valid API key targeting any Cloudflare-protected OpenAI-compatible endpointSuggested Fix
Add a
User-Agentheader to the request headers:This allows the request to pass Cloudflare's browser integrity check.