v2026.11.3
All Bundles
Bundle

Google Gemini API client. Supports text generation, multimodal inputs (image, audio, video), chat sessions, function calling, and caching. Set GOOGLE_API_KEY before use. Compile with -lib gemini.

CachedContent

Gemini Context Caching API - cache large content to reduce repeated token costs

Inherits: EndPoint

Operations

Create # function

Create a cached content resource with default TTL

function : Create(model:String, content:Content, ttl_secs:Int, key:String) ~ CachedContentItem

Parameters

NameTypeDescription
modelStringmodel name (e.g. "models/gemini-1.5-pro-001")
contentContentcontent to cache
ttl_secsInttime-to-live in seconds
keyStringAPI key

Return

TypeDescription
CachedContentItemcached content item, or Nil on failure

Create # function

Create a cached content resource

function : Create(model:String, content:Content, ttl_secs:Int, display_name:String, key:String) ~ CachedContentItem

Parameters

NameTypeDescription
modelStringmodel name (e.g. "models/gemini-1.5-pro-001")
contentContentcontent to cache
ttl_secsInttime-to-live in seconds
display_nameStringoptional human-readable name
keyStringAPI key

Return

TypeDescription
CachedContentItemcached content item, or Nil on failure

Delete # function

Delete a cached content resource

function : Delete(cache_name:String, key:String) ~ Bool

Parameters

NameTypeDescription
cache_nameStringresource name (e.g. "cachedContents/abc123")
keyStringAPI key

Return

TypeDescription
Booltrue if deleted successfully

Get # function

Get a cached content resource by name

function : Get(cache_name:String, key:String) ~ CachedContentItem

Parameters

NameTypeDescription
cache_nameStringresource name (e.g. "cachedContents/abc123")
keyStringAPI key

Return

TypeDescription
CachedContentItemcached content item, or Nil on failure

List # function

List all cached content resources

function : List(key:String) ~ Vector<CachedContentItem>

Parameters

NameTypeDescription
keyStringAPI key

Return

TypeDescription
Vector<CachedContentItem>list of cached content items

ParseItem # function

Parses a single cachedContents response body (create or get)

function : ParseItem(body:String) ~ CachedContentItem

Parameters

NameTypeDescription
bodyStringresponse body

Return

TypeDescription
CachedContentItemcached content item, or Nil on an error body (see GetLastError)

ParseList # function

Parses a cachedContents listing response body

function : ParseList(body:String) ~ Vector<CachedContentItem>

Parameters

NameTypeDescription
bodyStringresponse body

Return

TypeDescription
Vector<CachedContentItem>cached content items, or Nil on an error body (see GetLastError)