google-gemini / google-gemini/gemini-cli
Add support for `labels` field in Vertex AI API requests
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### What would you like to be added?
I’d like `gemini-cli` to support adding custom labels to the Vertex AI API requests it makes (e.g., `generateContent`, `streamGenerateContent`). Ideally, this could be configured through either:
- a `--label` or `--labels` CLI flag (e.g. `--label team=mlops`), or
- a `labels` section in `~/.config/gemini/settings.json`.
This would allow users to specify one or more key/value pairs that get passed through to the Vertex AI API’s `labels` field in the request body.
### Why is this needed?
Vertex AI supports **per-request labels** for attribution, cost tracking, and usage analytics (see [Add labels to API calls](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls#gemini-chat-label-samples-drest)). These labels show up in billing reports and make it easier to separate usage by team, project, or environment.
Right now, `gemini-cli` does not expose this field, so all CLI traffic appears unlabeled in billing and monitoring tools. Adding label support would:
* Align the CLI with best practices for resource labeling across GCP (see [Labeling resources](https://cloud.google.com/compute/docs/labeling-resources));
* Help teams using `gemini-cli` in shared environments distinguish workloads;
* Improve traceability and internal cost allocation; and
* Enable consistent labeling between direct API, SDK, and CLI usage.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.