Expand description
Gemini inference with in-memory session usage accounting and spending limits.
Gemini intentionally supports Gemini 3.1 Flash-Lite, Gemini 3.1 Pro
Preview, Nano Banana Pro, Pro multimodal inference, and Flash-Lite grounded
search. Nothing is persisted by this crate.
Structs§
- Cost
Breakdown - Locally calculated cost for one request or aggregate.
- Gemini
- Cloneable asynchronous Gemini client with shared in-memory session accounting.
- Generated
Image - A generated image returned by Nano Banana Pro.
- Generation
Options - Shared generation controls.
- Grounded
Search Request - Grounded Flash-Lite search request matching Kennedy fast search.
- Grounded
Search Response - Successful grounded-search output.
- Grouped
Usage - Usage totals grouped by one model or operation name.
- Inference
Request - One text-only inference request.
- Inference
Response - A successful text or image interaction.
- Limit
Status - Current-session spend and configured limits for all three UTC periods.
- Media
Input - One image or audio input held in memory for an inference request.
- Modality
Tokens - One modality-specific token count.
- Money
- A non-negative USD amount represented exactly in billionths of one dollar.
- Multimodal
Request - Image and/or audio inference request for Gemini 3.1 Pro.
- Nano
Banana ProRequest - Nano Banana Pro generation or editing request with fixed 2K output.
- Spending
Limits - Optional spending limits for the current session’s UTC hour, day, and month.
- Structured
Output - A validated JSON Schema requesting JSON structured output.
- Token
Usage - Token usage reported for one interaction.
- Usage
Breakdown - Complete current-session aggregate report for one selected window.
- Usage
Record - One in-memory usage record. Prompts, media, responses, and credentials are not recorded.
- Usage
Totals - Aggregated request, token, and cost values.
- WebSource
- One public source returned by grounded search.
Enums§
- Aspect
Ratio - Native-image aspect ratio supported by Nano Banana Pro at 2K.
- Completion
Status - Final interaction state returned by Gemini.
- Cost
Accuracy - Quality of a locally calculated cost.
- Error
- A local validation, accounting, transport, provider, or protocol failure.
- Limit
Period - UTC period used by one spending limit.
- Media
Kind - Inline media category accepted by Gemini 3.1 Pro.
- Modality
- Provider modality used for token accounting.
- Service
Tier - Gemini inference service tier.
- Text
Model - Text inference models intentionally supported by this crate.
- Thinking
Level - Maximum model reasoning depth.
- Usage
Window - Time selection for a current-session usage breakdown.
Constants§
- GEMINI_
31_ FLASH_ LITE - Stable Gemini 3.1 Flash-Lite model identifier.
- GEMINI_
31_ PRO - Current Gemini 3.1 Pro preview model identifier.
- NANO_
BANANA_ PRO - Stable Nano Banana Pro model identifier.
Type Aliases§
- Result
- The result type returned by this crate.