Failed to initialize session: This method is only supported in the Gemini Developer client

hey,
I am building a chat system that is built on Gemini and its large context.

The Agent (2.5 pro) uses Gemini cache and a Big query tool.
And I use client.files to upload files to the cache:
self.client.files.upload(file=local_path)

Now, we have decided to use a vertex-supervised tuning to build a cheaper and faster model based on the flash variant.

But to use vertex models, I need to use Vertex API Mode in the genai init

self.client = genai.Client(api_key=self.api_key)
to:

        self.client = genai.Client(

            vertexai=True,

            project="name bala bla",

            location="europe-west4"

        )

**The ISSUE:**
When I switch to Vertex Mode I get this error:
Failed to initialize session: This method is only supported in the Gemini Developer client.

after a lot of digging i found this
The Vertex-AI implementation of the API foes not include the file service.

What options do I have?
How can I create a cache while using a Vertex model?

Hi @daniel_lublinsky , thanks for bringing this up in the Build with AI > Agents channel—it’s a critical topic for optimizing agents!

To help me give you the best guidance: Are you currently focused on developing a custom, multi-step agent?

In the meantime, if you want to better understand how to use context caching with the GenAI SDK, here’s a canonical sample.

Let me know what you find when look at the code!

Hey thanks, I think I missed something critical correct me if I am wrong

My system gets a client GCS bucket and currently I downloaded eatch file then uploaded them to the cache.

What i should have done is direct the cache direct to file GCS url?