From e6a6300b707d21b4e60c9e68f4f6547c2a1da5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vedran=20Vidovi=C4=87?= Date: Thu, 11 Sep 2025 15:28:55 +0200 Subject: [PATCH] Describing the `labels` field use in the Vertex AI --- docs/my-website/docs/providers/vertex.md | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/my-website/docs/providers/vertex.md b/docs/my-website/docs/providers/vertex.md index fda0cee862..5a76189de9 100644 --- a/docs/my-website/docs/providers/vertex.md +++ b/docs/my-website/docs/providers/vertex.md @@ -2758,6 +2758,44 @@ curl http://localhost:4000/v1/fine_tuning/jobs \ +## Labels + + +Google enables you to add custom metadata to its `generateContent` and `streamGenerateContent` calls. +This mechanism is useful in Vertex AI because it allows costs and usage tracking over multiple +different applications or users. + + +### Usage + +You can use that feature through LiteLLM by sending `labels` or `metadata` field in your requests. + +If the client sets the `labels` field in the request to the LiteLLM, +the LiteLLM will pass the `labels` field to the Vertex AI backend. + +If the client sets the `metadata` field in the request to the LiteLLM and the `labels` field is not set, +the LiteLLM will create the `labels` field filled with `metadata` key/value pairs for all string values and +pass it to the Vertex AI backend. + + +Here is an example JSON request demonstrating the labels usage: + +```json +{ + "model": "gemini-2.0-flash-lite", + "messages": [ + { "role": "user", "content": "respond in 20 words. who are you?" } + ], + "labels": { + "client_app": "acme_comp_financial_app", + "department": "finance", + "project": "acme_ai" + } +} +``` + + + ## Extra ### Using `GOOGLE_APPLICATION_CREDENTIALS`