-
Notifications
You must be signed in to change notification settings - Fork 671
Open
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Description
The CreateCachedContentConfig does not support labels for cost tracking and billing attribution. This makes it difficult to allocate context caching costs across teams, environments, and projects.
Current Behavior
Adding labels to cache creation fails with a validation error:
config = CreateCachedContentConfig(
system_instruction="...",
contents=["..."],
ttl="3600s",
display_name="my-cache",
labels={ # This causes an error
"environment": "production",
"team": "ai-team"
}
)
client = genai.Client(vertexai=True, project=project, location=selected_location)
cache = await client.aio.caches.create(model="gemini-2.5-flash-lite", config=config)
Error:
1 validation error for CreateCachedContentConfig
labels
Extra inputs are not permitted [type=extra_forbidden, input_value={'environment': 'production'}, input_type=dict]`
Expected Behavior
Labels should be supported for context caching, similar to other Vertex AI resources:
config = CreateCachedContentConfig(
system_instruction="...",
contents=["..."],
ttl="3600s",
display_name="my-cache",
labels={ # Should work
"environment": "production",
"team": "ai-team",
"cost-center": "engineering"
}
)
Use Case
We need to track cache creation costs per team/environment for accurate billing and chargeback. Context caching incurs significant costs that require proper attribution for multi-tenant systems.
Environment
SDK Version: 1.52.0
Python Version: 3.12
krzysztofbury and oneryalcin
Metadata
Metadata
Assignees
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.