-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(cli): remove /api/v1 from custom endpoint base URL hint #1575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cjagwani
wants to merge
2
commits into
main
Choose a base branch
from
fix/onboard-base-url-hint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
For OpenRouter's OpenAI-compatible API, what exact base URL should clients use for Responses/Chat Completions requests? Is ithttps://openrouter.ai` orhttps://openrouter.ai/api/v1?`💡 Result:
Use
https://openrouter.ai/api/v1as the OpenAI-compatible base URL (not justhttps://openrouter.ai). (openrouter.ai)Then send requests to the usual paths, e.g.:
POST https://openrouter.ai/api/v1/chat/completions(openrouter.ai)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—
baseURLis 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/v1orhttps://your-host/v1, depending on your server). The SDK’s URL builder simply concatenatesbaseURLwith the request path (handling only the slash boundary). [1]By default, the SDK’s
baseURLis explicitly set tohttps://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
baseURLwill not have/api/v1appended. [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/v1base path or add automatic path handlingThe example at line 2375 shows
https://openrouter.ai, but OpenRouter's OpenAI-compatible API requireshttps://openrouter.ai/api/v1as the base URL. The OpenAI Node SDK does not auto-append/api/v1—it uses thebaseURLparameter as-is. This means validation probes will incorrectly targethttps://openrouter.ai/chat/completionsinstead ofhttps://openrouter.ai/api/v1/chat/completionsand 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/v1when the user provides a host-only URL for OpenAI-compatible endpoints.🤖 Prompt for AI Agents