Skip to content

fix(cli): remove /api/v1 from custom endpoint base URL hint#1575

Open
cjagwani wants to merge 2 commits intomainfrom
fix/onboard-base-url-hint
Open

fix(cli): remove /api/v1 from custom endpoint base URL hint#1575
cjagwani wants to merge 2 commits intomainfrom
fix/onboard-base-url-hint

Conversation

@cjagwani
Copy link
Copy Markdown
Contributor

@cjagwani cjagwani commented Apr 7, 2026

Summary

Fixes #1171

Problem: The onboard wizard's "Other OpenAI-compatible endpoint" prompt shows https://openrouter.ai/api/v1 as the example base URL. The OpenAI SDK appends /api/v1 internally, so users who follow the hint get a doubled path (/api/v1/api/v1), causing a 429 error. The error message then tells the user to try a different model name, which is misleading since the URL is the actual problem.

Fix: Drop the /api/v1 suffix from the example so users enter just the hostname (e.g., https://openrouter.ai).

Summary by CodeRabbit

  • Documentation
    • Updated the example URL in the custom OpenAI-compatible base URL configuration prompt for clarity.

The onboard wizard's "Other OpenAI-compatible endpoint" prompt showed
`https://openrouter.ai/api/v1` as the example base URL. The SDK appends
`/api/v1` internally, so users who followed the hint got a doubled path
and a misleading 429 error. Drop the path suffix from the example so
users enter just the hostname.

Closes #1171

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@cjagwani cjagwani self-assigned this Apr 7, 2026
@cjagwani cjagwani requested a review from brandonpelfrey April 7, 2026 15:57
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

The onboarding wizard's example text for OpenAI-compatible base URLs was corrected. The prompt example changed from https://openrouter.ai/api/v1 to https://openrouter.ai to accurately reflect the expected input format, as the system automatically appends the API path during requests.

Changes

Cohort / File(s) Summary
Onboarding Prompt Text
bin/lib/onboard.js
Updated example URL in interactive prompt from https://openrouter.ai/api/v1 to https://openrouter.ai for OpenAI-compatible endpoint configuration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A hop, a skip, one line we mend,
The URL path now makes more sense,
No /api/v1 confusion in sight,
Just the domain, clean and light! ✨
Your OpenRouter dreams take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: removing '/api/v1' from the custom endpoint base URL hint in the CLI onboard prompt.
Linked Issues check ✅ Passed The PR successfully addresses issue #1171 by removing '/api/v1' from the example base URL hint, preventing the doubled path error that was causing HTTP 429 validation failures.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to updating the prompt text for the custom OpenAI-compatible endpoint base URL, directly addressing the issue without introducing unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/onboard-base-url-hint

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bin/lib/onboard.js`:
- Line 2375: The prompt currently shows "https://openrouter.ai" which lacks the
required /api/v1 path; update the prompt call (the prompt("  OpenAI-compatible
base URL ...") invocation) to show the full example
"https://openrouter.ai/api/v1" and/or add normalization after reading the user's
input (the variable that captures the prompt result) to parse the URL and
automatically append "/api/v1" when the supplied value has no path (and ensure
you don't append if a path already exists or if the input already ends with
"/api/v1" to avoid double slashes); use standard URL parsing to detect host-only
vs path-present and trim trailing slashes when constructing the final base URL
used for probes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 03142c7b-9997-4726-90e2-85b3dc30cc3d

📥 Commits

Reviewing files that changed from the base of the PR and between 6c300b3 and b1488ee.

📒 Files selected for processing (1)
  • bin/lib/onboard.js

const endpointInput = isNonInteractive()
? (process.env.NEMOCLAW_ENDPOINT_URL || "").trim()
: await prompt(" OpenAI-compatible base URL (e.g., https://openrouter.ai/api/v1): ");
: await prompt(" OpenAI-compatible base URL (e.g., https://openrouter.ai): ");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

For OpenRouter's OpenAI-compatible API, what exact base URL should clients use for Responses/Chat Completions requests? Is it https://openrouter.ai` or https://openrouter.ai/api/v1?`

💡 Result:

Use https://openrouter.ai/api/v1 as the OpenAI-compatible base URL (not just https://openrouter.ai). (openrouter.ai)

Then send requests to the usual paths, e.g.:

  • Chat Completions: POST https://openrouter.ai/api/v1/chat/completions (openrouter.ai)
  • Responses: POST https://openrouter.ai/api/v1/responses (openrouter.ai)

Citations:


🌐 Web query:

In the OpenAI Node SDK, does setting baseURL to a host-only URL auto-append /api/v1, or must the full API base path be provided explicitly?

💡 Result:

No—baseURL is used as-is. The OpenAI Node SDK does not auto-append /api/v1 (or any version path) when you provide a host-only URL; you must include the full base path yourself (e.g., https://your-host/api/v1 or https://your-host/v1, depending on your server). The SDK’s URL builder simply concatenates baseURL with the request path (handling only the slash boundary). [1]

By default, the SDK’s baseURL is explicitly set to https://api.openai.com/v1, which further implies the version path is part of the base URL, not something appended automatically. [2]

Answer: You must provide the full API base path explicitly; host-only baseURL will not have /api/v1 appended. [1][2]

References: [1] https://app.unpkg.com/openai%406.21.0/files/client.mjs, [2] https://github.com/openai/openai-node/blob/08833f20ae4eab6d23ddf989557e1c05a471352b/src/index.ts


Update prompt example to include /api/v1 base path or add automatic path handling

The example at line 2375 shows https://openrouter.ai, but OpenRouter's OpenAI-compatible API requires https://openrouter.ai/api/v1 as the base URL. The OpenAI Node SDK does not auto-append /api/v1—it uses the baseURL parameter as-is. This means validation probes will incorrectly target https://openrouter.ai/chat/completions instead of https://openrouter.ai/api/v1/chat/completions and will fail.

Either (a) update the prompt to show the full base path (https://openrouter.ai/api/v1), or (b) add logic to automatically append /api/v1 when the user provides a host-only URL for OpenAI-compatible endpoints.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/lib/onboard.js` at line 2375, The prompt currently shows
"https://openrouter.ai" which lacks the required /api/v1 path; update the prompt
call (the prompt("  OpenAI-compatible base URL ...") invocation) to show the
full example "https://openrouter.ai/api/v1" and/or add normalization after
reading the user's input (the variable that captures the prompt result) to parse
the URL and automatically append "/api/v1" when the supplied value has no path
(and ensure you don't append if a path already exists or if the input already
ends with "/api/v1" to avoid double slashes); use standard URL parsing to detect
host-only vs path-present and trim trailing slashes when constructing the final
base URL used for probes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NemoClaw][MacOS][Brev] [tag v0.0.1] Base URL example is misleading as per other OpenAI-compatible endpoint

1 participant