Skip to content

Helper agents keep using the Gemini API key when Gemini should run on Vertex AI #227

Open

Description

@ajstars1

When Gemini should run on Vertex AI, part of ARTEMIS still calls the Gemini Developer API with GOOGLE_API_KEY. Several helper agents build their own Gemini clients from the key instead of following the agent config:

  • the Flash step summarizer (get_google_llm always creates a google endpoint)
  • the explorer's native engine (genai.Client(api_key=...))
  • the object detector and the video analyzer (native client from the key)

With a free-tier key this shows up as 429 RESOURCE_EXHAUSTED (generate_content_free_tier_requests) from the step summarizer during Flash runs, plus 503s from the developer API at busy times, even though the main model could run on Vertex. There is no single setting that moves all Gemini traffic to Vertex.

Separately, the explicit vertexai provider (ChatVertexAI) fails on the second turn with Gemini 3 (#156); #186 addresses that.

Proposal: honour google-genai's own switch, GOOGLE_GENAI_USE_VERTEXAI=true. When set, every google endpoint is created as ChatGoogleGenerativeAI(vertexai=True, project=..., location=...) with Application Default Credentials, and the explorer and video analyzer use the LangChain path instead of their key-based native path. Project and location come from VERTEX_AI_PROJECT / GOOGLE_CLOUD_PROJECT and VERTEX_AI_LOCATION / GOOGLE_CLOUD_LOCATION (default global, where Gemini 3 is served). Because these calls go through google-genai, they keep the developer-API message conversion and avoid the part-order error from #156. I have a small PR for this.

Environment: Ubuntu, ARTEMIS main, Flash profile, gemini-3.8-flash, Nothing Phone (3a) on Android 16.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions