gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

API renew after just using for 1 hour , How do i fix it?

Open arrowtrades opened this issue 1 year ago • 5 comments

What happened?

First time using gemini cli, Built an android project for about one hour.

Usage details tells me i used up 3 million input tokens.

But in bottom right of cli i am seeing 100% context left.

This is the error i get

"[API Error: {"error":{"message":"{\n  \"error\": {\n    \"code\": 400,\n    \"message\": \"API key expired. Please renew the API key.\",\n    \"status\": \"INVALID_ARGUMENT\",\n    \"details\": [\n 
       {\n        \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n        \"reason\": \"API_KEY_INVALID\",\n        \"domain\": \"googleapis.com\",\n        \"metadata\": {\n          
  \"service\": \"generativelanguage.googleapis.com\"\n        }\n      },\n      {\n        \"@type\": \"type.googleapis.com/google.rpc.LocalizedMessage\",\n        \"locale\": \"en-US\",\n        
  \"message\": \"API key expired. Please renew the API key.\"\n      }\n    ]\n  }\n}\n","code":400,"status":"Bad Request"}}]

I have tried to use a newly generated api key from ai studio and still same problems.

Please help me fix it.

What did you expect to happen?

I expected to continue using gemini CLI

Client information

$ gemini /about
# About Gemini CLI                                                                   │
│                                                                                    │
│ CLI Version                  0.1.12                                                │
│ Model                        gemini-2.5-pro                                        │
│ Sandbox                      no sandbox                                            │
│ OS                           linux                                                 │
│ Auth Method                  gemini-api-key          

Login information

Auth

Anything else we need to know?

The context window seems to be very misleading. I used 3 million input tokens in 1 hour and it just kept saying i still had 95% usage left.

arrowtrades avatar Jul 18 '25 03:07 arrowtrades

Found possible duplicate issues:

  • #1712: (0.9083024263381958)
  • #4690: (0.9082939299432619)

gsquared94 avatar Jul 30 '25 01:07 gsquared94

@arrowtrades is this still an issue for you?

NTaylorMullen avatar Aug 22 '25 20:08 NTaylorMullen

I'm having this issue as well. Error occurs after 2 mins of usage

Ethan-Otto avatar Sep 06 '25 18:09 Ethan-Otto

I seem to have solved it by enabling gemini code assist for my project. Using this page

Image

https://console.cloud.google.com/gemini-admin/products?project=

Ethan-Otto avatar Sep 06 '25 18:09 Ethan-Otto

@arrowtrades I'm sorry you ran into this issue. Unfortunately, there isn't enough information to repro this bug. If you are still running into this issue, please file a new issue with detailed repro instructions. Thanks!

joshualitt avatar Sep 17 '25 22:09 joshualitt