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"
}
]
}
}Explizites Kontext-Caching
Gemini Explizites Kontext-Caching - Gültigkeitsdauer verlängern oder verkürzen
Nur die Gültigkeitsdauer ist änderbar, nicht der Inhalt. Geben Sie entweder ttl (neue Dauer ab jetzt, z. B. "7200s") oder expireTime (neuer absoluter Ablaufzeitpunkt) an.
- Der neue Ablauf muss 60 Sekunden bis 168 Stunden in der Zukunft liegen.
- Nur
ttloderexpireTimewird akzeptiert; beide zusammen oder andere Felder führen zu 400. - Verlängern: Speichergebühr für die zusätzliche Dauer, in Sekunden; weniger als 1 Sekunde wird als 1 Sekunde berechnet. Verkürzen: Bereits berechnete Speichergebühren werden nicht erstattet.
- Kostenpflichtiger Vorgang: Der Key benötigt Modellzugriff; es gelten die Preise seiner aktuellen Benutzergruppe. Unzureichendes Guthaben führt zu 402.
- Bei Wiederholung derselben Verlängerungsanfrage verhindert der Header
Idempotency-Keydoppelte Abbuchungen.
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: Die Standard-BaseURL ist
https://direct.evolink.ai und bietet bessere Unterstützung für Textmodelle sowie persistente Verbindungen. https://api.evolink.ai ist der primäre Endpunkt für multimodale Dienste und dient bei Textmodellen als Ausweichadresse.Nur die Gültigkeitsdauer kann geändert werden: Senden Sie entweder
ttl oder expireTime. Eine Verlängerung wird für die zusätzliche Dauer berechnet; eine Verkürzung wird nicht erstattet.Autorisierungen
Alle Endpunkte erfordern Bearer-Token-Authentifizierung
API-Key erhalten:
Besuchen Sie die API-Key-Verwaltung.
Diesen Anfrageheader hinzufügen:
Authorization: Bearer YOUR_API_KEY
Auch das native Gemini-Format wird akzeptiert: der Header x-goog-api-key: YOUR_API_KEY oder der URL-Parameter ?key=YOUR_API_KEY.
Pfadparameter
Body
application/json
Antwort
Aktualisierte Cache-Metadaten; expireTime ist der neue Ablaufzeitpunkt