Must specify `GOOGLE_CLOUD_PROJECT` for Gemini CLI provider to work — but how?
Description
With Gemini CLI on Kilo Code I get:
Gemini CLI API error: [{
"error": {
"code": 403,
"message": "Permission denied on resource project default.",
"errors": [
{
"message": "Permission denied on resource project default.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CONSUMER_INVALID",
"domain": "googleapis.com",
"metadata": {
"containerInfo": "default",
"service": "cloudaicompanion.googleapis.com",
"consumer": "projects/default"
}
},
{
"@type": "type.googleapis.com/google.rpc.LocalizedMessage",
"locale": "en-US",
"message": "Permission denied on resource project default."
},
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console",
"url": "https://console.developers.google.com"
}
]
}
]
}
}
]
Retry attempt 1
Retrying now...
I have a paid Google Code Assist account, and Google CLI in my terminal works only if I provide the GOOGLE_CLOUD_PROJECT env variable (this is described in https://github.com/jarvisphere/gemini-cli/blob/main/docs/cli/authentication.md ).
I have it defined in ~/.gemini/.env and in my general shell.
But with Kilo Code, this does not work. I presume that the GOOGLE_CLOUD_PROJECT env variable is not passed to Gemin CLI.
This https://github.com/Kilo-Org/kilocode/pull/947 didn’t fully fix it
Unfortunately I can only double this
HI,
- if on WSL try setting on windows where vscode is installed...
- close +open vscode and try, after env updates
Hi @twardoch, have you tried setting the GOOGLE_CLOUD_PROJECT env variable before starting vscode?
UPD Looks like it can be put to ~/.gemini/.env: https://github.com/Kilo-Org/kilocode/commit/e8fd6c98543faff8b0bf082cbc73df040989bf97
(Below are older investigations.)
Surprisingly, the geminiCliProjectId setting is there in the code: https://github.com/Kilo-Org/kilocode/blob/86299adde7b49fc6f210d464180aa47c852a3fb8/packages/types/src/provider-settings.ts#L198
However, I cannot see it in the UI (Kilo Code ver. 4.79.0). Though, the commit introducing it should be present in the version.
You have to use quotation mark in your .env, even though gcloud project id don't contain spaces or special characters.
export GOOGLE_CLOUD_PROJECT="your project id" instead of export GOOGLE_CLOUD_PROJECT=your project id
You have to use quotation mark in your
.env
Works w/ & w/o.
if I specify the GOOGLE_CLOUD_PROJECT it works, however I have the pro plan and by specifying the project it uses the free quota instead of my pro plan. How to use the pro quota in this case?
if I specify the GOOGLE_CLOUD_PROJECT it works, however I have the pro plan and by specifying the project it uses the free quota instead of my pro plan. How to use the pro quota in this case?
Similar question how can i get it working without setting a GOOGLE_CLOUD_PROJECT and like just being able to use the pro/free plan for it?
For more context: So i just upgraded my main google account to use google AI pro and now i suddenly get the above described error when trying to use kilo code with Gemini-CLI but when i delete the Gemini folder then login with my other google account that has no AI pro subscription i can use it with any problems.
I found out that now google created a secondary project sort of hidden to track the gemini cli quota google console check this you will see a project with an id and no name. This is the one it should be on the env variables.
It works however I am reaching the quota and then when I try gemini cli it works so something is no quite right with the provider or how google tracks it
EDIT: I was wrong about the quotas provider configuration, this approach works perfectly.