OpenClaw's HTTP server is returning HTML (UI pages) on all API endpoints instead of JSON responses. This breaks programmatic access to the OpenClaw Gateway via standard OpenAI-compatible endpoints (/v1/models, /v1/chat/completions, etc.), making it impossible to integrate OpenClaw with external agents, applications, or automation tools.
The root cause appears to be a catch-all route serving the UI that intercepts and overrides API endpoint handlers.
Root Cause Analysis
Hypothesis: OpenClaw's routing configuration has a catch-all route that serves the React UI, and this route is executing before or instead of the API endpoint handlers.
Evidence
Consistent behavior: ALL API endpoints return HTML, suggesting a single catch-all route
GET requests work for UI: Browser requests to / receive the HTML UI correctly
No 404 errors: Requests to invalid endpoints don't return 404, they return the UI
Timing: Routes appear to be evaluated in a single pass, not cascading
Likely Location in Code
Based on typical Express.js/Fastify patterns, the issue is likely in one of these files:
dist/gateway-.js (main HTTP server)
dist/router-.js (routing configuration)
dist/api-*.js (API endpoint definitions)