This commit is contained in:
seb
2026-10-06 17:57:50 +02:00
parent 07f0d5ba80
commit 2e8c36fa01
6 changed files with 152 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ import jwt from 'jsonwebtoken';
import { defineTool, ToolError, OpenRouterProvider } from 'libllmorbiter';
import env from '../config/env.js';
import { prepareVfs } from './vfs.js';
import { resolveOpenRouterKey } from './llm-key.js';
import { resolveOpenRouterKey, resolveImageModel } from './llm-key.js';
/**
* analyze_image — lets a vision model actually LOOK at images held in the VFS.
@@ -365,9 +365,10 @@ export function createAnalyzeImageTool({ googleAuthId, model }) {
: question || 'Describe this image, judge its visual quality, flag any watermark, text overlay or defect, and say whether it is usable as a product or category image.';
const apiKey = await resolveOpenRouterKey(googleAuthId);
const imageModel = (await resolveImageModel(googleAuthId)) || model;
const provider = new OpenRouterProvider({ apiKey, apiUrl: env.openrouterApiUrl });
const response = await provider.chatCompletions({
model,
model: imageModel,
messages: [
{
role: 'user',