import { chat } from '@tanstack/ai';
import { createOpenaiChat } from '@tanstack/ai-openai';
import type { OpenAIChatModel } from '@tanstack/ai-openai';
const adapter = createOpenaiChat(
'google/gemma-3-27b-it' as OpenAIChatModel,
process.env.SUPA_API_KEY!,
{ baseURL: 'https://api.supa.works/openai/v1' },
);
const text = await chat({
adapter,
stream: false,
messages: [
{
role: 'user',
content: [
{ type: 'text', content: 'What is in this image?' },
{
type: 'image',
source: { type: 'url', value: 'https://example.com/photo.png' },
},
],
},
],
});
console.log(text);