How can I check my requests per day remaining? #3096
-
Using API, I can check it in Google AI Stuido.
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
You can always use the |
Beta Was this translation helpful? Give feedback.
-
Try google cloud... it has the possibility to add gemini api, to a cloud project. Just ignore the cloud project and use the key from it for local gemini api usage etc... but it has metered thing in the cloud that can show what the gemini is using... yes... it's a bit strange and all, and sometimes it lags or doesn't work/update or maybe even limit is not there, but it probably is, but sometimes it works :):):) |
Beta Was this translation helpful? Give feedback.
-
Well, you can also teach Gemini CLI (via MCP would be best) to read your online usage ... |
Beta Was this translation helpful? Give feedback.
-
Discussion: Approaches for Checking Gemini API Daily Usage This document outlines various approaches for the Gemini CLI to check and display the user's daily Gemini API usage. The primary goal is to provide transparency on API consumption, especially concerning the free tier limits. Option 1: Hypothetical Direct Gemini API Endpoint Description: Pros:
Cons:
Option 2: Google Cloud Monitoring via Description: Pros:
Cons:
Option 3: Google Cloud Monitoring Python Client Library (Programmatic) Description: Pros:
Cons:
Conclusion: ♊ AI, 📯 on behalf of Manamama |
Beta Was this translation helpful? Give feedback.
-
Implementation Plan: Checking Gemini API Daily Usage in the CLIThis document outlines a phased implementation plan for integrating Gemini API daily usage checking into the Gemini CLI. The approaches are ordered from most feasible and recommended to least feasible, providing a clear path forward for development. Phase 1: Most Feasible - Google Cloud Monitoring via Python Client LibraryApproach Overview:This approach leverages the official Core Mechanism:The Python client library will fetch the Minimal Pseudocode/Example:from google.cloud import monitoring
from datetime import datetime, timedelta
def get_gemini_api_daily_usage(project_id: str) -> int:
client = monitoring.Client(project=project_id)
end_time = datetime.utcnow()
start_time = end_time - timedelta(days=1) # Query for the last 24 hours
query = client.query(metric_type='cloudaicompanion.googleapis.com/usage/response_count')
query = query.select_interval(start_time, end_time)
query = query.align(monitoring.Aggregation.Aligner.ALIGN_DELTA, hours=24)
total_requests = 0
for ts in query.fetch():
for point in ts.points:
# Assuming double_value for simplicity, could be int64_value or distribution_value.count
total_requests += point.value.double_value
return int(total_requests)
# Example CLI integration:
# PROJECT_ID = GET_GCLOUD_PROJECT_ID()
# if PROJECT_ID:
# daily_usage = get_gemini_api_daily_usage(PROJECT_ID)
# DISPLAY_MESSAGE(f"Gemini API requests (last 24h): {daily_usage}") Pros:
Cons:
Phase 2: Viable Alternative - Google Cloud Monitoring via
|
Beta Was this translation helpful? Give feedback.
You can always use the
/stats
command to see the usage for a particular session, but there's no way within Gemini CLI to see your daily quota – at least, not yet.