fix: fixes doulbe v1 prefix in passthrough openai routes#174
fix: fixes doulbe v1 prefix in passthrough openai routes#174
v1 prefix in passthrough openai routes#174Conversation
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.
| fixture: fixtures.OaiChatFallthrough, | ||
| basePath: "", | ||
| requestPath: "/openai/v1/models", | ||
| expectedUpstreamPath: "/models", |
There was a problem hiding this comment.
This should be /v1/models no?
There was a problem hiding this comment.
With empty base URL (no path to add as a prefix) I believe it should be /models.
This is also how I understand the OpenAI API. Base URL contains /v1 but the endpoint in API is just /models.
This is different from Anthropic where base URL doesn't contain /v1 so /v1 is part of path "in API".
There was a problem hiding this comment.
Yes but base URL contains v1 as specified for example in Codex documentation: https://developers.openai.com/codex/config-advanced#config-and-state-locations
There was a problem hiding this comment.
We can't rely on the base URL being set in a specific way.
Our tests should show how we relay requests to the correct upstream path whether the configured base URL includes a /v1 suffix or not.
Semantically I'd expect expectedUpstreamPath to be the full path of the upstream API, otherwise it will confuse future readers like it did me.
I only skimmed this; I'll give this a proper review on Monday.

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