Context caching allows you to save and reuse precomputed input tokens that you wish to use repeatedly, for example when asking different questions about the same media file. This can lead to cost and speed savings, depending on the usage. For a detailed introduction, see the Context caching guide.
Method: cachedContents.create
Creates CachedContent resource.
Endpoint
posthttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Request body
The request body contains an instance of CachedContent.
Optional. Input only. Immutable. The content to cache.
Optional. Input only. Immutable. A list of Tools the model may use to generate the next response
expirationUnion type
Specifies when this resource will expire. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: