curl --request PATCH \
--url https://direct.evolink.ai/v1beta/cachedContents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"ttl": "7200s"
}'{
"name": "cachedContents/20261103012026348092000s1oTuB96",
"model": "models/gemini-3.8-flash",
"displayName": "product-manual-v3",
"createTime": "2026-11-03T01:20:27.311Z",
"updateTime": "2026-11-03T01:35:10.020Z",
"expireTime": "2026-11-03T03:35:10.000Z",
"usageMetadata": {
"totalTokenCount": 7525
}
}{
"error": {
"code": 400,
"message": "new expiry must be at least 60s in the future",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INVALID_ARGUMENT",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 401,
"message": "Invalid API key",
"status": "UNAUTHENTICATED"
}
}{
"error": {
"code": 402,
"message": "insufficient quota for cache storage extension",
"status": "RESOURCE_EXHAUSTED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INSUFFICIENT_QUOTA",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 403,
"message": "This key is not allowed to use model gemini-3.8-flash",
"status": "PERMISSION_DENIED"
}
}{
"error": {
"code": 404,
"message": "cached content not found",
"status": "NOT_FOUND",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CACHE_NOT_FOUND",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded",
"status": "RESOURCE_EXHAUSTED"
}
}{
"error": {
"code": 502,
"message": "the request could not be completed due to a service authorization problem; please retry later or contact support",
"status": "INTERNAL",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "UPSTREAM_ERROR",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 503,
"message": "cached content is temporarily unavailable; please retry later",
"status": "UNAVAILABLE",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CACHE_CHANNEL_UNAVAILABLE",
"domain": "evolink.ai"
}
]
}
}Explicit Context Caching
Gemini Explicit Context Caching - Extend or shorten the lifetime
Only the lifetime can be changed, not the content. Provide either ttl (the new lifetime starting now, such as "7200s") or expireTime (the new absolute expiry time).
- The new expiry must be between 60 seconds and 168 hours from now.
- Only
ttlorexpireTimeis accepted; providing both or other fields returns 400. - Extending: Storage fees are charged for the added duration, measured in seconds, with durations below 1 second charged as 1 second. Shortening: Storage fees already charged are not refunded.
- This is a paid operation: the Key must have access to the model, and the price of its current user group applies. Insufficient balance returns 402.
- When retrying the same extension request, use the
Idempotency-Keyheader to avoid duplicate charges.
PATCH
/
v1beta
/
cachedContents
/
{id}
curl --request PATCH \
--url https://direct.evolink.ai/v1beta/cachedContents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"ttl": "7200s"
}'{
"name": "cachedContents/20261103012026348092000s1oTuB96",
"model": "models/gemini-3.8-flash",
"displayName": "product-manual-v3",
"createTime": "2026-11-03T01:20:27.311Z",
"updateTime": "2026-11-03T01:35:10.020Z",
"expireTime": "2026-11-03T03:35:10.000Z",
"usageMetadata": {
"totalTokenCount": 7525
}
}{
"error": {
"code": 400,
"message": "new expiry must be at least 60s in the future",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INVALID_ARGUMENT",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 401,
"message": "Invalid API key",
"status": "UNAUTHENTICATED"
}
}{
"error": {
"code": 402,
"message": "insufficient quota for cache storage extension",
"status": "RESOURCE_EXHAUSTED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INSUFFICIENT_QUOTA",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 403,
"message": "This key is not allowed to use model gemini-3.8-flash",
"status": "PERMISSION_DENIED"
}
}{
"error": {
"code": 404,
"message": "cached content not found",
"status": "NOT_FOUND",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CACHE_NOT_FOUND",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded",
"status": "RESOURCE_EXHAUSTED"
}
}{
"error": {
"code": 502,
"message": "the request could not be completed due to a service authorization problem; please retry later or contact support",
"status": "INTERNAL",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "UPSTREAM_ERROR",
"domain": "evolink.ai"
}
]
}
}{
"error": {
"code": 503,
"message": "cached content is temporarily unavailable; please retry later",
"status": "UNAVAILABLE",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CACHE_CHANNEL_UNAVAILABLE",
"domain": "evolink.ai"
}
]
}
}BaseURL: The default BaseURL is
https://direct.evolink.ai, which has better support for text models and long-lived connections. https://api.evolink.ai is the primary endpoint for multimodal services and serves as a fallback address for text models.Only the lifetime can be changed: send either
ttl or expireTime. Extending charges storage for the added duration; shortening is not refunded.Authorizations
All endpoints require Bearer Token authentication
Get an API Key:
Visit API Key Management to get your API Key.
Add this request header:
Authorization: Bearer YOUR_API_KEY
The Gemini native format is also accepted: the x-goog-api-key: YOUR_API_KEY header or the ?key=YOUR_API_KEY URL parameter.
Path Parameters
Body
application/json
Response
Updated cache metadata; expireTime is the new expiry time