pub struct Gemini { /* private fields */ }Expand description
Cloneable asynchronous Gemini client with shared in-memory session accounting.
Implementations§
Source§impl Gemini
impl Gemini
Sourcepub fn open(api_key: impl Into<String>) -> Result<Self>
pub fn open(api_key: impl Into<String>) -> Result<Self>
Opens a client with a new in-memory usage session and retains the API key in memory.
Clones share the same session records and limits. Dropping the last clone discards them.
Sourcepub async fn infer_flash_lite(
&self,
request: InferenceRequest,
) -> Result<InferenceResponse>
pub async fn infer_flash_lite( &self, request: InferenceRequest, ) -> Result<InferenceResponse>
Performs text-only inference with Gemini 3.1 Flash-Lite.
Sourcepub async fn infer_pro(
&self,
request: InferenceRequest,
) -> Result<InferenceResponse>
pub async fn infer_pro( &self, request: InferenceRequest, ) -> Result<InferenceResponse>
Performs text-only inference with Gemini 3.1 Pro Preview.
Sourcepub async fn infer_pro_multimodal(
&self,
request: MultimodalRequest,
) -> Result<InferenceResponse>
pub async fn infer_pro_multimodal( &self, request: MultimodalRequest, ) -> Result<InferenceResponse>
Performs Pro inference over text plus inline images and/or audio.
Sourcepub async fn nano_banana_pro(
&self,
request: NanoBananaProRequest,
) -> Result<InferenceResponse>
pub async fn nano_banana_pro( &self, request: NanoBananaProRequest, ) -> Result<InferenceResponse>
Generates or edits a 2K image with Nano Banana Pro.
Sourcepub async fn grounded_search(
&self,
request: GroundedSearchRequest,
) -> Result<GroundedSearchResponse>
pub async fn grounded_search( &self, request: GroundedSearchRequest, ) -> Result<GroundedSearchResponse>
Performs focused Google Search grounding with Flash-Lite.
Defaults preserve Kennedy’s low-thinking Priority fast-search behavior.
Sourcepub fn spending_limits(&self) -> Result<SpendingLimits>
pub fn spending_limits(&self) -> Result<SpendingLimits>
Returns configured local spending limits.
Sourcepub fn set_spending_limits(&self, limits: SpendingLimits) -> Result<()>
pub fn set_spending_limits(&self, limits: SpendingLimits) -> Result<()>
Replaces UTC hourly, daily, and monthly limits atomically.
Sourcepub fn spending_status(&self) -> Result<LimitStatus>
pub fn spending_status(&self) -> Result<LimitStatus>
Returns current UTC hour/day/month spending and limits.
Sourcepub fn usage_breakdown(&self, window: UsageWindow) -> Result<UsageBreakdown>
pub fn usage_breakdown(&self, window: UsageWindow) -> Result<UsageBreakdown>
Returns aggregate request, modality-token, and calculated-cost usage.
Sourcepub fn usage_records(
&self,
window: UsageWindow,
maximum: usize,
) -> Result<Vec<UsageRecord>>
pub fn usage_records( &self, window: UsageWindow, maximum: usize, ) -> Result<Vec<UsageRecord>>
Returns newest-first individual usage records, up to 10,000.