Store Chat Messages & State Without Managing Infrastructure.Check Out DialogueDB
Skip to content

Google Gemini ​

When using Google Gemini models, llm-exe will make POST requests to https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent. All models are supported if you pass google.chat.v1 as the first argument, and then specify a model in the options.

llm-exe ships typed shorthands for the most common Gemini models so you do not have to remember the exact model strings:

ShorthandDefault model
google.chat.v1none — set model
google.gemini-3.1-flash-litegemini-3.1-flash-lite
google.gemini-3.5-flashgemini-3.5-flash
google.gemini-3.5-flash-litegemini-3.5-flash-lite
google.gemini-3.6-flashgemini-3.6-flash
google.gemini-3.7-flashgemini-3.7-flash
google.gemini-3.8-flashgemini-3.8-flash
google.gemini-2.5-flashgemini-2.5-flash
google.gemini-2.5-flash-litegemini-2.5-flash-lite
google.gemini-2.5-progemini-2.5-pro

Google now serves requests for gemini-3.5-flash with gemini-3.6-flash, and requests for gemini-3.7-flash with gemini-3.8-flash (the response's modelVersion names the model that answered). It has announced no shutdown date for either, so both shorthands keep working without a deprecation warning. For new code, use google.gemini-3.8-flash.

Gemini 2.5 access

Google limits the 2.5 models to projects that have used them before, so a new project gets a 404 from google.gemini-2.5-flash, google.gemini-2.5-flash-lite, and google.gemini-2.5-pro. Google says these models are not deprecated and will keep being served, so llm-exe doesn't warn on them. For a new project, use a 3.x shorthand.

Deprecated shorthands ​

These shorthands still resolve, but emit a deprecation warning when used. Migrate to an active shorthand above.

ShorthandDefault modelStatus
google.gemini-2.0-flashgemini-2.0-flashShut down on 2026-06-01 — requests will fail at the API
google.gemini-2.0-flash-litegemini-2.0-flash-liteShut down on 2026-06-01 — requests will fail at the API
google.gemini-1.5-progemini-1.5-proShut down on 2025-09-29 — requests will fail at the API

Basic Usage ​

Gemini Chat ​

ts
const llm = useLlm("google.chat.v1", {
  model: "gemini-3.8-flash", // specify a model
});

Gemini Chat By Model ​

ts
const llm = useLlm("google.gemini-3.8-flash", {
  // other options,
  // no model needed, using gemini-3.8-flash
});
INFO
You can use the following models using this shorthand:
  • google.gemini-3.1-flash-lite
  • google.gemini-3.5-flash
  • google.gemini-3.5-flash-lite
  • google.gemini-3.6-flash
  • google.gemini-3.7-flash
  • google.gemini-3.8-flash
  • google.gemini-2.5-flash
  • google.gemini-2.5-flash-lite
  • google.gemini-2.5-pro
  • google.gemini-2.0-flashdeprecated
    Model "google.gemini-2.0-flash" was shut down by Google on 2026-06-01 and will fail at the API. Migrate to "google.gemini-3.8-flash".
  • google.gemini-2.0-flash-litedeprecated
    Model "google.gemini-2.0-flash-lite" was shut down by Google on 2026-06-01 and will fail at the API. Migrate to "google.gemini-3.1-flash-lite".
  • google.gemini-1.5-prodeprecated
    Model "google.gemini-1.5-pro" was shut down by Google on 2025-09-29 and will fail at the API. Migrate to "google.gemini-3.8-flash".
Deprecated shorthands still resolve and will continue to work for now, but the underlying provider may stop accepting them at any time. Migrate to a current shorthand when you can.

Authentication ​

To authenticate, you need to provide a Google Gemini API Key. You can provide the API key various ways, depending on your use case.

  1. Pass in as execute options using geminiApiKey
  2. Pass in as setup options using geminiApiKey
  3. Use a default key by setting an environment variable of GEMINI_API_KEY

Generally you pass the LLM instance off to an LLM Executor and call that. However, it is possible to interact with the LLM object directly, if you wanted.

ts
// call the LLM directly with a prompt
await llm.call(prompt);

Gemini-Specific Options ​

In addition to the generic options, the following options are Gemini-specific and can be passed in when creating a llm function.

OptionTypeDefaultDescription
modelstring—The model to use. Must be specified when using google.chat.v1. See Google Gemini Docs
geminiApiKeystringundefinedAPI key for Google. See authentication
effortstringundefinedMaps to generationConfig.thinkingConfig.thinkingBudget. Valid values: "minimal", "low", "medium", "high", sent as budgets of 1024, 1024, 8192, and 24576 tokens. Sent for every Gemini 2.5 or later model, including all the 3.x shorthands; dropped on earlier models or for a value outside that list.

NOTE

Besides model, geminiApiKey, and effort, the Gemini provider maps the generic options temperature, topP, maxTokens (sent as maxOutputTokens), and stopSequences, all under generationConfig.

See Google Gemini API Reference for details.