-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
Custom OpenAI-compatible provider with baseUrl without /v1 fails with cryptic 'incomplete terminal response' error #84697
Copy link
Copy link
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug Description
When configuring a custom OpenAI-compatible API provider (e.g.,
spanagent.xyz), if thebaseUrlis set tohttps://spanagent.xyz(without/v1suffix), OpenClaw constructs the request URL ashttps://spanagent.xyz/chat/completions. This endpoint returns an HTML page (200 OK, Content-Type: text/html), which the streaming handler cannot parse. The error surfaced to the user is cryptic:Meanwhile, the log shows
contentType=text/html; charset=utf-8but no clear indication that the URL path is wrong.Steps to Reproduce
openclaw onboardor manual config:{ "baseUrl": "https://spanagent.xyz", "api": "openai-completions", "models": [{ "id": "deepseek-v4-flash", "reasoning": true, ... }] }openclaw agent --agent <agent> --message "hi" --model <provider>/deepseek-v4-flash --localhttps://spanagent.xyz/chat/completions(no/v1prefix)incomplete terminal response— no mention of wrong URLExpected Behavior
https://spanagent.xyz/v1as the base URL (OpenAI SDK appends/chat/completionsto the base URL)Actual Behavior
Silent failure with misleading
incomplete terminal responsemessage. Requires log inspection to findcontentType=text/htmland discover the wrong URL path.Environment
Additional Context
The OpenAI JavaScript SDK (used internally by pi-ai/pi-agent-core) constructs the endpoint URL as
${baseUrl}/chat/completions. This means for any provider serving under a path prefix (like/v1/), the baseUrl MUST include that prefix.For example:
https://spanagent.xyz→ request goes tohttps://spanagent.xyz/chat/completions(wrong)https://spanagent.xyz/v1→ request goes tohttps://spanagent.xyz/v1/chat/completions(correct)A secondary issue was also encountered: the default
maxTokensof 384000 for deepseek models exceeded the providers limit (65536), causing HTTP 400. The error message for this was clear (400 field MaxTokens invalid, should be in [1, 65536]), so that part is fine — just noting the config guidance gap.