Skip to content

fix(runtime): normalize custom base URLs to include /v1 suffix for OpenAI-compatible endpoints#4618

Open
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/custom-base-url-v1-path
Open

fix(runtime): normalize custom base URLs to include /v1 suffix for OpenAI-compatible endpoints#4618
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/custom-base-url-v1-path

Conversation

@ygd58

@ygd58 ygd58 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #4600

Problem

Custom OpenAI-compatible endpoints without /v1 (e.g. https://api.x.ai) caused 404 errors because the OpenAI SDK appends /chat/completions directly to base_url, resulting in /chat/completions instead of /v1/chat/completions.

Fix

Added _ensure_v1_suffix() helper that appends /v1 when needed. Applied to:

  1. CLI explicit credentials path
  2. Credential refresh paths (2 locations)

Skips already-versioned paths: /v1, /v2, /v3, /v4, /anthropic, /api/v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Custom OPENAI_BASE_URL drops /v1 on chat completions for OpenAI-compatible endpoints

2 participants