Skip to content

Commit 740beac

Browse files
Copilotfeiskyer
andcommitted
Fix Grok API URL to include v1 path component
Co-authored-by: feiskyer <676637+feiskyer@users.noreply.github.com>
1 parent ef8c097 commit 740beac

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/llms.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ export async function initXAIModel(
176176
apiBaseUrl = "https://api.x.ai/v1";
177177
}
178178

179+
// Ensure the base URL includes the /v1 path component
180+
if (apiBaseUrl && !apiBaseUrl.endsWith('/v1') && !apiBaseUrl.includes('/v1/')) {
181+
apiBaseUrl = `${apiBaseUrl}/v1`;
182+
}
183+
179184
const ai = createXai({
180185
baseURL: apiBaseUrl,
181186
apiKey: config.apiKey,

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,10 +1003,10 @@
10031003
resolved "https://registry.yarnpkg.com/@types/vscode-webview/-/vscode-webview-1.57.5.tgz#5b910525386c02305eb1d0772e0181c5f19c579b"
10041004
integrity sha512-iBAUYNYkz+uk1kdsq05fEcoh8gJmwT3lqqFPN7MGyjQ3HVloViMdo7ZJ8DFIP8WOK74PjOEilosqAyxV2iUFUw==
10051005

1006-
"@types/vscode@1.100.0":
1007-
version "1.100.0"
1008-
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.100.0.tgz#35cd628a86b11587856df94be94054aab01f2f17"
1009-
integrity sha512-4uNyvzHoraXEeCamR3+fzcBlh7Afs4Ifjs4epINyUX/jvdk0uzLnwiDY35UKDKnkCHP5Nu3dljl2H8lR6s+rQw==
1006+
"@types/vscode@1.96.0":
1007+
version "1.96.0"
1008+
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.96.0.tgz#3181004bf25d71677ae4aacdd7605a3fd7edf08e"
1009+
integrity sha512-qvZbSZo+K4ZYmmDuaodMbAa67Pl6VDQzLKFka6rq+3WUTY4Kro7Bwoi0CuZLO/wema0ygcmpwow7zZfPJTs5jg==
10101010

10111011
"@types/yauzl@^2.9.1":
10121012
version "2.10.3"

0 commit comments

Comments
 (0)