diff --git a/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts b/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts index 9e4042fa3c..f2ee0f58f4 100644 --- a/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts +++ b/src/renderer/src/aiCore/clients/openai/OpenAIBaseClient.ts @@ -99,8 +99,12 @@ export abstract class OpenAIBaseClient< override async listModels(): Promise { try { const sdk = await this.getSdkInstance() - const response = await sdk.models.list() if (this.provider.id === 'github') { + // GitHub Models 其 models 和 chat completions 两个接口的 baseUrl 不一样 + const baseUrl = 'https://models.github.ai/catalog/' + const newSdk = sdk.withOptions({ baseURL: baseUrl }) + const response = await newSdk.models.list() + // @ts-ignore key is not typed return response?.body .map((model) => ({ @@ -111,6 +115,7 @@ export abstract class OpenAIBaseClient< })) .filter(isSupportedModel) } + const response = await sdk.models.list() if (this.provider.id === 'together') { // @ts-ignore key is not typed return response?.body.map((model) => ({ diff --git a/src/renderer/src/config/providers.ts b/src/renderer/src/config/providers.ts index 1a26e2c882..4ff48c6fa2 100644 --- a/src/renderer/src/config/providers.ts +++ b/src/renderer/src/config/providers.ts @@ -298,7 +298,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record = name: 'Github Models', type: 'openai', apiKey: '', - apiHost: 'https://models.inference.ai.azure.com/', + apiHost: 'https://models.github.ai/inference', models: SYSTEM_MODELS.github, isSystem: true, enabled: false @@ -818,7 +818,7 @@ export const PROVIDER_URLS: Record = { }, github: { api: { - url: 'https://models.inference.ai.azure.com/' + url: 'https://models.github.ai/' }, websites: { official: 'https://github.com/marketplace/models',