Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/lib/onboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@ async function setupNim(gpu) {
if (selected.key === "custom") {
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.

const navigation = getNavigationChoice(endpointInput);
if (navigation === "back") {
console.log(" Returning to provider selection.");
Expand Down
Loading