import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://api.aiapilab.com/v1",
apiKey: $AIAPILAB_API_KEY
})
async function main() {
const completion = await openai.chat.completions.create({
model: "google/gemini-flash-1.5",
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What's in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
}
}
]
}
]
})
console.log(completion.choices[0].message)
}
main()
Feature/Aspect | GPT-4O | Gemini 1.5 Pro | Gemini 1.5 Flash |
---|---|---|---|
Latency | Fast response times | Higher latency than Flash | Sub-second average first-token latency |
Model Type | Advanced, general-purpose model | Comprehensive, best for general tasks | Lightweight, optimized for speed |
Context Window | 128,000 tokens | 2 million tokens | 1 million tokens (up to 2 million via waitlist) |
Multimodal Capability | Supports text, images, audio, and video | Supports text, images, audio, and video | Supports text, images, audio, and video |
Performance on Specific Tasks | Strong in creative and complex tasks | Best for complex reasoning tasks | Excels in summarization, chat applications, and data extraction |