Gemini 3.8 Flash API

google/gemini-3.8-flash
1,048,576 tokens · Max output 65,536 tokens · 120 input / 12 cached input / 600 output credits / 1M tokens

Gemini 3.8 Flash turns text, images, audio, video, and documents into code, analysis, and answers for long-horizon coding and multi-step reasoning. Its million-token context carries project details and source material across agent workflows.

Gemini 3.8 Flash

Google · chat-completions

Chat with Gemini 3.8 Flash

Provide a coding goal, relevant source files or documents, and the expected result. Return test feedback in later turns to investigate problems and refine the implementation.

Ctrl / ⌘ + Enter to send0 / 32,000

Continue with

Gemini 3.8 Flash

Gemini 3.8 Flash is Google’s model for long-horizon coding, multi-step reasoning, and multimodal analysis. A 1,048,576-token input context brings code, documents, and media into the same task, while system instructions and sampling settings guide the answer. With up to 65,536 output tokens, it can develop fixes across files, compare extensive sources, and carry reasoning through successive agent steps.

Why Choose Gemini 3.8 Flash?

  • Long-horizon codingCarry requirements, related files, and test feedback through code changes and debugging.

  • Million-token contextCompare source files, reports, and reference material within a 1,048,576-token input window.

  • Multi-step reasoningWork through dependent questions and use earlier analysis alongside new evidence.

  • Multimodal analysisConnect text, images, audio, video, and PDFs to extract information and explain evidence.

Parameters

ParameterRequirementDescription
modelChat Completions: required

Set to google/gemini-3.8-flash; use the same complete ID in the Gemini Native URL.

messagesChat Completions: required

A non-empty ordered array with system, user, or assistant roles and text content.

temperatureOptional

Sampling temperature from 0 to 2; the Playground uses steps of 0.1.

Default1
max_tokensChat Completions: optional

An integer from 1 to 65,536 setting the output budget. The Playground defaults to 4,096.

Default4096 (Playground)
top_pChat Completions: optional

Nucleus sampling probability from 0 to 1; the Playground uses steps of 0.1.

Default1
contentsGemini Native: required

A non-empty ordered array with user or model roles and parts.

contents[].parts[].inlineDataGemini Native: media input

API media bytes in base64 data with a mimeType, alongside text parts.

systemInstructionGemini Native: optional

System guidance in parts[].text. The Playground starts with You are a helpful assistant.

generationConfig.temperatureGemini Native: optional

Sampling temperature from 0 to 2.

Default1
generationConfig.maxOutputTokensGemini Native: optional

An integer from 1 to 65,536; the Playground defaults to 4,096.

Default4096 (Playground)
generationConfig.topPGemini Native: optional

Nucleus sampling probability from 0 to 1.

Default1
streamChat Completions: optional

false returns JSON; true returns SSE events. Gemini Native streams through streamGenerateContent?alt=sse.

Defaultfalsetrue

How to Use

  1. Provide the task and sourcesDescribe the goal, acceptance criteria, and relevant code or documents.

  2. Choose a request formatStart with Chat Completions or switch to Gemini Native for contents and generationConfig.

  3. Set generation controlsUse System Prompt to guide the task, then set Temperature, Top P, and Max Tokens.

  4. Review and iterateRead the answer and token usage, then add test results or evidence for the next turn.

Pricing

Standard input, cached input, and output are metered separately per 1M tokens and settle in credits. Thinking tokens count as output.

UsageRateDetails
Input$0.600 · 120 credits / 1M tokensStandard input tokens; reported cache reads use the cached-input rate.
Cached Input$0.060 · 12 credits / 1M tokensCache-read tokens reported in the response.
Output (including thinking tokens)$3.00 · 600 credits / 1M tokensGenerated answer tokens plus thinking tokens.

Best Use Cases

  • Development across filesReview call paths, related source files, and failure logs to propose fixes and test coverage.

  • Iterative agent tasksLet your application execute steps and return results and new questions to continue complex work.

  • Long-document researchCompare reports or PDFs, extract differences, and organize conclusions around source evidence.

  • Audio, video, and image analysisAsk focused questions about media and turn visual and language evidence into text findings.

Pro Tips

  • For coding tasks, provide related files, errors, expected behavior, and test criteria; return execution results in later turns.
  • Label long documents and sections clearly, and ask for source locations with the findings.
  • For media requests, send mimeType and base64 data in Gemini Native inlineData, with a text part describing the analysis goal.
  • Leave output budget for the answer and thinking, then use reported usage to adjust the next request.

Usage Notes

  • The input limit is 1,048,576 tokens; maximum output is 65,536 tokens.
  • The Playground sends text conversations and starts with Chat Completions, Form mode, and 4,096 output tokens.
  • Chat Completions and Gemini Native offer complete JSON or SSE responses; the API tab shares the Playground’s protocol selection.
  • Cache reads are billed separately. Standard input equals total input minus reported cache reads; thinking tokens add to output usage.

Related Models

Gemini 3.8 Flash API — Frequently asked questions

What is the Gemini 3.8 Flash API?

Gemini 3.8 Flash is Google’s model for turning text, images, audio, video, and documents into code, analysis, and answers, with a focus on long-horizon coding and multi-step agent work. Its million-token context carries source material, while system instructions and generation controls guide the response. Call it through Chat Completions or Gemini Native, or try a text conversation in the Playground above.

How does Gemini 3.8 Flash handle long-horizon coding?

Provide requirements, related source files, and acceptance criteria. The model can break down implementation steps, examine dependencies across files, and propose changes. Return test and execution results in later turns to investigate failures and refine the fix.

How does Gemini 3.8 Flash compare with Gemini 3.7 Flash?

Google identifies Gemini 3.8 Flash as the successor to Gemini 3.7 Flash, with a focus on long-horizon software engineering and agent workflows. Their published limits are 1,048,576 input and 65,536 output tokens. Keep the messages or contents structure and verify your coding and document tasks with the Gemini 3.8 Flash model ID.

How much document context can Gemini 3.8 Flash handle?

The input limit is 1,048,576 tokens, allowing long documents, project files, and instructions in one task. Document length depends on tokenization. Label files and sections so findings can be checked against their sources.

How can Gemini 3.8 Flash analyze a PDF?

Use Gemini Native with the PDF’s base64 bytes in inlineData.data and application/pdf as mimeType. Add a text part describing the summary, extraction, or comparison task. Ask for page or section references to check findings against the document.

How does Gemini 3.8 Flash understand audio and video?

Send media bytes in Gemini Native inlineData with the appropriate mimeType and a text instruction for transcription, summarization, or content analysis. The model returns text findings. Identify the segments or events that matter to focus the analysis.

How should I set the Gemini 3.8 Flash output budget?

Maximum output is 65,536 tokens. The Playground starts at 4,096 and accepts integers from 1 to 65,536. Use max_tokens in Chat Completions or generationConfig.maxOutputTokens in Gemini Native. Leave room for thinking and the final answer; thinking tokens are billed as output.

How is cached input priced for Gemini 3.8 Flash?

Per 1M tokens, standard input costs $0.600 or 120 credits, cached input $0.060 or 12 credits, and output including thinking $3.00 or 600 credits. Reported cache reads are metered separately and subtracted from standard input usage.