Skip to content

Commit 9e89034

Browse files
DGideaslramos15
andauthored
fix: improve custom OpenAI model URL resolution to prevent duplicate version paths (#1074)
- Update resolveCustomOAIUrl function to handle URLs with existing version patterns - Remove special handling for /v1 to support any version number (v1, v2, v4, etc.) Co-authored-by: Logan Ramos <[email protected]>
1 parent bf66d60 commit 9e89034

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/extension/byok/vscode-node/customOAIProvider.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export function resolveCustomOAIUrl(modelId: string, url: string): string {
2525
if (url.endsWith('/')) {
2626
url = url.slice(0, -1);
2727
}
28-
// if url ends with `/v1` remove it
29-
if (url.endsWith('/v1')) {
30-
url = url.slice(0, -3);
28+
29+
// Check if URL already contains any version pattern like /v1, /v2, etc
30+
const versionPattern = /\/v\d+$/;
31+
if (versionPattern.test(url)) {
32+
return `${url}/chat/completions`;
3133
}
3234

3335
// For standard OpenAI-compatible endpoints, just append the standard path

0 commit comments

Comments
 (0)