fix: fixes double v1 prefix in passthrough openai routes#174
Merged
Conversation
With default OpenAI base url "https://api.openai.com/v1/" passthough routes have `v1` prefix added 2 times resulting in requests being forwarded to "https://api.openai.com/v1/v1/" This PR fixes the issue.
dannykopping
reviewed
Feb 6, 2026
v1 prefix in passthrough openai routesv1 prefix in passthrough openai routes
dannykopping
reviewed
Feb 9, 2026
dannykopping
approved these changes
Feb 9, 2026
|
|
||
| func (p *OpenAI) RoutePrefix() string { | ||
| // Route prefix includes version to match default OpenAI base URL. | ||
| // More detailed explanation: https://github.com/coder/aibridge/pull/174#discussion_r2782320152 |
Collaborator
There was a problem hiding this comment.
Nit: deep linking doesn't really work once threads are resolved. I'd prefer you copied the reasoning inline.
| // | ||
| // When request is bridged, interceptor created based on route processes the request. | ||
| // When request is passed through the {host} + {aibridge root} + {provider prefix} URL part | ||
| // is replaced by provider's base URL and request is forwarded. |
Collaborator
There was a problem hiding this comment.
Suggested change
| // is replaced by provider's base URL and request is forwarded. | |
| // is replaced by provider's BaseURL() and request is forwarded. |
| // | ||
| // - OpenAI chat completions | ||
| // AI Bridge base URL (set in Codex): "https://host.coder.com/api/v2/aibridge/openai/v1" | ||
| // Upstream base URl (set in coder config): http://api.openai.com/v1 |
Collaborator
There was a problem hiding this comment.
Suggested change
| // Upstream base URl (set in coder config): http://api.openai.com/v1 | |
| // Upstream base URL (set in coder config): http://api.openai.com/v1 |
Contributor
Author
Merge activity
|
This was referenced Feb 9, 2026
Merged
pawbana
added a commit
to coder/coder
that referenced
this pull request
Feb 10, 2026
Updates AI Bridge library to apply fix: coder/aibridge#174
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

fix: fixes doulbe
v1prefix in passthrough openai routesBug introduced in #159
With default OpenAI base url
https://api.openai.com/v1/pass though routes have
v1prefix added 2 times (frombase url path + pass though route prefix) resulting
in requests being forwarded to
https://api.openai.com/v1/v1/This PR fixes the issue.
Fixes: #176