feat: get real models

This commit is contained in:
evanp committed 2026-11-06 11:42:35 -05:00
1 parent 0737a09ac2
commit f0bad116e0
1 file changed
+30
+30
View File
@@ -1,9 +1,39 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
const BASE_URL = 'https://gateway.inference.coop/v1';
export function activate(context: vscode.ExtensionContext) { export function activate(context: vscode.ExtensionContext) {
const provider: vscode.LanguageModelChatProvider = { const provider: vscode.LanguageModelChatProvider = {
async provideLanguageModelChatInformation() { async provideLanguageModelChatInformation() {
const key = vscode.workspace
.getConfiguration('inferenceCoop')
.get<string>('apiKey');
if (!key) {
return []; return [];
}
const res = await fetch(`${BASE_URL}/models`, {
headers: { Authorization: `Bearer ${key}` }
});
if (!res.ok) {
vscode.window.showErrorMessage(
`Inference Coop: model list failed (HTTP ${res.status})`
);
return [];
}
const body = (await res.json()) as { data: Array<{ id: string; mode?: string }> };
return body.data
.filter(m => !m.mode || m.mode === 'chat')
.map(m => ({
id: m.id,
name: m.id,
family: 'inference-coop',
version: '1.0.0',
maxInputTokens: 131072,
maxOutputTokens: 8192,
capabilities: { toolCalling: true, imageInput: false }
}));
}, },
async provideLanguageModelChatResponse() { async provideLanguageModelChatResponse() {
throw new Error('Not implemented yet'); throw new Error('Not implemented yet');