POST
javascript
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); } })();
RESPONSE
application/json
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


messagesArray

An array of objects containing the role and content


rolestr

Could be "user", "assistant" or "system".


contentstr

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 — Fast, Affordable Multimodal LLM by Google

What is Gemini 2.5 Flash Lite?

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.

Key Features

  • 1 million-token context window — process entire codebases, legal documents, or long transcripts in a single call
  • Multimodal input — accepts text, images, audio, and video in the same API; responds in text
  • Optional thinking mode — toggle reasoning budget on-demand; boosts AIME math accuracy to 63.1% without switching models
  • Native tool support — Grounding with Google Search, code execution, URL context
  • Ultra-low latency — faster TTFT than both Gemini 2.0 Flash-Lite and 2.0 Flash on broad prompt benchmarks
  • Stable GA release — production-ready with consistent versioning and SLA guarantees

Best Use Cases

Gemini 2.5 Flash Lite excels in cost-sensitive, high-throughput developer workflows:

  • Classification & routing — tag, label, or route millions of inputs per day at minimal cost
  • Translation & localization — high-quality multilingual output at scale
  • Real-time chat & customer support — sub-second first-token response for conversational UX
  • Document analysis — summarize, extract, or reason over long PDFs, contracts, and reports in one context window
  • Vision + text tasks — describe images, answer questions about screenshots, extract structured data from photos
  • Bulk content generation — drafts, summaries, rewrites at volume where GPT-4-class quality is unnecessary

Prompt Tips and Output Quality

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.

FAQs

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.