Skip to content

Commit 5af5dff

Browse files
committed
Provide api key when fetching models
1 parent b003088 commit 5af5dff

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/api/providers/requesty.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ export class RequestyHandler extends OpenAiHandler {
5858
}
5959
}
6060

61-
export async function getRequestyModels() {
61+
export async function getRequestyModels(apiKey?: string) {
6262
const models: Record<string, ModelInfo> = {}
6363

6464
try {
65-
const response = await axios.get("https://router.requesty.ai/v1/models")
65+
const headers: Record<string, string> = {}
66+
if (apiKey) {
67+
headers["Authorization"] = `Bearer ${apiKey}`
68+
}
69+
70+
const url = "https://router.requesty.ai/v1/models"
71+
const response = await axios.get(url, { headers })
6672
const rawModels = response.data.data
6773

6874
for (const rawModel of rawModels) {

src/core/webview/webviewMessageHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
399399

400400
break
401401
case "refreshRequestyModels":
402-
const requestyModels = await getRequestyModels()
402+
const requestyModels = await getRequestyModels(message.values?.apiKey)
403403

404404
if (Object.keys(requestyModels).length > 0) {
405405
await provider.writeModelsToCache(GlobalFileNames.requestyModels, requestyModels)

0 commit comments

Comments
 (0)