1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const axios = require('axios');
const fs = require('fs');
const path = require('path');
// helper function to help you convert your local images into base64 format
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/gemini-2.5-flash-lite";
const data = {
"messages": [
{
"role": "user",
"content" : "tell me a joke on cats"
},
{
"role": "assistant",
"content" : "here is a joke about cats..."
},
{
"role": "user",
"content" : "now a joke on dogs"
},
]
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();An array of objects containing the role and content
Could be "user", "assistant" or "system".
A string containing the user's query or the assistant's response.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Gemini 2.5 Flash Lite is Google's most cost-efficient model in the Gemini 2.5 family, released as stable and generally available in February 2026. It delivers the core intelligence of Gemini 2.5 at the lowest price point and lowest latency, making it purpose-built for high-scale, latency-sensitive applications. Despite its lightweight positioning, it supports multimodal inputs (text, images, audio, video), a 1 million-token context window, and optional reasoning (thinking) mode — capabilities that rivals charge premium rates for.
The model streams at 392.8 tokens/second with a 0.29-second time-to-first-token, making it one of the fastest production-grade LLMs available via API today.
Gemini 2.5 Flash Lite excels in cost-sensitive, high-throughput developer workflows:
For best results with Gemini 2.5 Flash Lite, structure your prompts with clear instructions before context. Use the image parameter to pass a publicly accessible URL for visual tasks — the model will reason over the image alongside your text prompt.
When using the API for classification or extraction, include a few-shot example directly in the prompt (the 1M context window makes this practically free). For math or multi-step reasoning, enable thinking mode via the API to get significantly stronger results without switching to a heavier model.
Output quality is strong for factual QA, summarization, translation, and structured extraction. For creative writing or nuanced reasoning, consider Gemini 2.5 Flash or Gemini 2.5 Pro.
What is the context window for Gemini 2.5 Flash Lite? 1 million tokens — one of the largest context windows among lightweight models.
Does Gemini 2.5 Flash Lite support image input? Yes. Pass any publicly accessible image URL to the image parameter alongside your text prompt.
How fast is Gemini 2.5 Flash Lite? It streams at ~393 tokens/second with a 0.29s time-to-first-token, making it faster than Gemini 2.0 Flash-Lite.
Can I use thinking/reasoning mode with Flash Lite? Yes. Optional thinking budgets are supported, boosting accuracy on complex tasks like math (AIME: 63.1%) without requiring a larger model.
What is the pricing for Gemini 2.5 Flash Lite? $0.125 per million input tokens and $0.50 per million output tokens via Segmind.
How does it compare to Gemini 2.5 Flash? Flash Lite is cheaper and faster with lower latency; Flash offers stronger reasoning and higher quality for complex tasks. Flash Lite is ideal when volume and cost matter most.