Vertex AI API key refresh #3841

Closed
opened 2025-11-11 15:41:00 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @aryzle on GitHub (Feb 14, 2025).

Feature Request

Is your feature request related to a problem? Please describe.
When using Google Vertex AI, the API key expires every 1-12 hours (1 by default). Currently there's no way to automatically refresh the key, so it has to be done manually through the admin UI or via an API request to the /openai/config/update endpoint.

Describe the solution you'd like
https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/call-vertex-using-openai-library#refresh_your_credentials
There is an example here of refreshing creds automatically for google APIs. If there's a way to designate that we're using Vertex AI, then the app could refresh the token when it expires.

Describe alternatives you've considered
Currently you can either update the key manually in the ui or through the /openai/config/update endpoint. I've automated this by running a cron that updated the key every 55m.

TOKEN=$(gcloud auth application-default print-access-token)

curl -X POST "<openwebui-URL>/openai/config/update" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <openwebui API KEY>" \
    -d "{
        \"ENABLE_OPENAI_API\": true,
        \"OPENAI_API_BASE_URLS\": [\"https://<REGION>-aiplatform.googleapis.com/v1beta1/projects/<PROJECTID>/locations/<REGION>/endpoints/openapi\"],
        \"OPENAI_API_KEYS\": [\"$TOKEN\"],
        \"OPENAI_API_CONFIGS\": {
            \"0\": {
                \"enable\": true,
                \"model_ids\": [\"google/gemini-1.5-flash\", \"google/gemini-2.0-flash-exp\"]
            }
        }
    }"

Context
This would likely be helpful for other APIs as well, not just Vertex AI

Originally created by @aryzle on GitHub (Feb 14, 2025). # Feature Request **Is your feature request related to a problem? Please describe.** When using Google Vertex AI, the API key expires every 1-12 hours (1 by default). Currently there's no way to automatically refresh the key, so it has to be done manually through the admin UI or via an API request to the `/openai/config/update` endpoint. **Describe the solution you'd like** https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/call-vertex-using-openai-library#refresh_your_credentials There is an example here of refreshing creds automatically for google APIs. If there's a way to designate that we're using Vertex AI, then the app could refresh the token when it expires. **Describe alternatives you've considered** Currently you can either update the key manually in the ui or through the `/openai/config/update` endpoint. I've automated this by running a cron that updated the key every 55m. ``` TOKEN=$(gcloud auth application-default print-access-token) curl -X POST "<openwebui-URL>/openai/config/update" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <openwebui API KEY>" \ -d "{ \"ENABLE_OPENAI_API\": true, \"OPENAI_API_BASE_URLS\": [\"https://<REGION>-aiplatform.googleapis.com/v1beta1/projects/<PROJECTID>/locations/<REGION>/endpoints/openapi\"], \"OPENAI_API_KEYS\": [\"$TOKEN\"], \"OPENAI_API_CONFIGS\": { \"0\": { \"enable\": true, \"model_ids\": [\"google/gemini-1.5-flash\", \"google/gemini-2.0-flash-exp\"] } } }" ``` **Context** This would likely be helpful for other APIs as well, not just Vertex AI
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3841