Auto-correct local provider URLs missing /v1 suffix
For LM Studio, Ollama, and custom OpenAI-compatible endpoints, automatically append /v1 to the URL if missing. This prevents the common "Unexpected endpoint or method" error when users enter URLs like "http://127.0.0.1:1234" instead of the required "http://127.0.0.1:1234/v1". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
ddd9dd7d4d
commit
4e784a4f4e
@@ -769,6 +769,16 @@ class SID_LLM_API(comfy_io.ComfyNode):
|
||||
if not actual_url:
|
||||
raise ValueError(f"API URL is required for {provider}")
|
||||
|
||||
# Auto-fix common URL mistakes for local providers
|
||||
# LM Studio and Ollama require /v1 suffix for OpenAI-compatible API
|
||||
if provider_name in ("lmstudio", "ollama", "openai_compatible"):
|
||||
# Remove trailing slash first
|
||||
actual_url = actual_url.rstrip("/")
|
||||
# Add /v1 if missing
|
||||
if not actual_url.endswith("/v1"):
|
||||
actual_url = f"{actual_url}/v1"
|
||||
print(f"[SID_LLM_API] Auto-corrected URL to: {actual_url}")
|
||||
|
||||
# Check if provider requires API key
|
||||
requires_key = provider_config.get("requires_key", True)
|
||||
is_local = provider_config.get("is_local", False)
|
||||
|
||||
Reference in New Issue
Block a user