Skip to content

feat(auth): add Google Vertex Express x-goog-api-key header support#4375

Open
ysnock404 wants to merge 1 commit intoNousResearch:mainfrom
ysnock404:feat/google-vertex-express-auth
Open

feat(auth): add Google Vertex Express x-goog-api-key header support#4375
ysnock404 wants to merge 1 commit intoNousResearch:mainfrom
ysnock404:feat/google-vertex-express-auth

Conversation

@ysnock404
Copy link
Copy Markdown

Summary

Google Vertex Express API requires x-goog-api-key header instead of Authorization: Bearer. This PR adds detection for aiplatform.googleapis.com URLs and automatically switches to the correct header.

Changes

  • run_agent.py: When effective_base contains aiplatform.googleapis.com, pass the API key via x-goog-api-key header and use a placeholder api_key to satisfy the OpenAI SDK validation

How it works

Users configure a custom provider in config.yaml:

model:
  default: google/gemini-2.5-flash-lite
  provider: google-vertex-express

custom_providers:
- name: google-vertex-express
  base_url: https://aiplatform.googleapis.com/v1beta1/projects/<PROJECT>/locations/us-central1/endpoints/openapi
  api_key: 'AQ.Ab8...'
  api_mode: chat_completions

The agent then correctly authenticates with Vertex Express using x-goog-api-key header.

Google Vertex Express API requires x-goog-api-key header instead of
Authorization: Bearer. When the custom provider base_url contains
aiplatform.googleapis.com, pass the api_key via x-goog-api-key header
and use a placeholder api_key to satisfy the OpenAI SDK validation.

This enables using google-vertex-express as a custom provider in
config.yaml with the Vertex Express API key directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant