Skip to content

@standardagents/google

Google Gemini and Imagen provider package for Standard Agents using the official @google/genai SDK

Overview

The @standardagents/google package provides a Standard Agents provider for Google's Gemini and Imagen APIs. It uses the official @google/genai SDK, supports Gemini text/tool/image requests, and routes Imagen generation and editing through Google's dedicated image endpoints.

Key Features
  • Official @google/genai SDK integration
  • Gemini text, multimodal, JSON, streaming, and tool calling support
  • Gemini thought-signature preservation for multi-step tool calling
  • Imagen image generation and edit support
  • Built-in pricing for documented Gemini models used in request logs
  • Public model discovery through models.list()

Installation

pnpm
pnpm add @standardagents/google

Quick Start

import { defineModel } from '@standardagents/spec';
import { google } from '@standardagents/google';

export default defineModel({
  name: 'gemini-fast',
  provider: google,
  model: 'gemini-3.8-flash',
  providerOptions: {
    responseModalities: ['TEXT'],
  },
});

Common Models

  • gemini-3.1-pro-preview
  • gemini-3.8-flash
  • gemini-2.5-flash-lite
  • gemini-2.5-flash-image
  • gemini-3-pro-image-preview
  • imagen-4.0-generate-001
  • imagen-3.0-capability-001

Provider Options

Common Gemini options include responseModalities, candidateCount, cachedContent, thinkingConfig, imageConfig, and safetySettings.

Common Imagen options include numberOfImages, negativePrompt, aspectRatio, outputMimeType, imageSize, and editMode.

Tool Result Images

The Google provider preserves Standard Agents' internal tool-result message structure and only rewrites the outbound Google request:

  • Gemini 3 series models keep image tool results nested in functionResponse.parts
  • Older Google chat models get a text-only functionResponse, with the image emitted as a sibling inline image part instead

This keeps provider fallbacks and log storage provider-agnostic while still working around older Google models that reject multimodal functionResponse payloads.

Pricing

The provider includes built-in pricing for documented Gemini models such as gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-flash-image, and gemini-3-pro-image-preview.

The provider also includes per-image pricing for Imagen 4 generation variants and imagen-3.0-capability-001. For models without bundled pricing, set prices on your model definition.

Environment Setup

.dev.vars
GOOGLE_API_KEY=...