# Gemini live api won't connect from local computer

**URL:** <https://discuss.ai.google.dev/t/gemini-live-api-wont-connect-from-local-computer/96334>\
**Category:** Gemini API\
**Tags:** vertexai, api\
**Created:** [August 1, 2025, 6:27am UTC](https://discuss.ai.google.dev/t/gemini-live-api-wont-connect-from-local-computer/96334 "2025-08-01T06:27:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manmat](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/manmat/32/59997_2.png) [@manmat](https://discuss.ai.google.dev/u/manmat)\
**Post date:** [August 1, 2025, 6:27am UTC](https://discuss.ai.google.dev/t/gemini-live-api-wont-connect-from-local-computer/96334/1 "2025-08-01T06:27:49Z")

</div>

Hi, I am trying to connect to the live api using Vertex AI and when I am running my code on my local machine I get a timeout error during opening handshake. When I am running my code from Google Cloud shell then it works. I have tried from two different computers (both macOS and 2 different networks). Has anyone run into this issue before? What would be the solution or some steps to debug it?

Here is the code I am running:

```python
from google import genai
from google.genai.types import (
    Content,
    LiveConnectConfig,
    Modality,
    Part,
)
import asyncio

client = genai.Client(
    vertexai=True,
    project=GCP_PROJECT,
    location="global"
)
MODEL_ID = "gemini-2.0-flash-live-preview-04-09"

async def main():

    async with client.aio.live.connect(
        model=MODEL_ID,
        config=LiveConnectConfig(response_modalities=[Modality.TEXT]),
    ) as session:
        text_input = "Hello? Gemini, are you there?"
        print("> ", text_input, "\n")
        await session.send_client_content(
            turns=Content(role="user", parts=[Part(text=text_input)])
        )

        response = []

        async for message in session.receive():
            if message.text:
                response.append(message.text)

        print("".join(response))
    # Example output:
    # > Hello? Gemini, are you there?
    # Yes, I'm here. What would you like to talk about?

if __name__ == " __main__":
    asyncio.run(main())

```

---

<div class="post-metadata">

**Author:** ![GUNAND\_MAYANGLAMBAM](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/gunand_mayanglambam/32/4964_2.png) [@GUNAND\_MAYANGLAMBAM](https://discuss.ai.google.dev/u/GUNAND_MAYANGLAMBAM)\
**Post date:** [August 1, 2025, 7:31am UTC](https://discuss.ai.google.dev/t/gemini-live-api-wont-connect-from-local-computer/96334/3 "2025-08-01T07:31:14Z")

</div>

Hi @manmat , welcome to the forum.

Have you already done the authentication step locally (e.g. with `gcloud auth application-default login`)? Also, could you please share the exact error message??

Thank you.

---

<div class="post-metadata">

**Author:** ![manmat](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/manmat/32/59997_2.png) [@manmat](https://discuss.ai.google.dev/u/manmat)\
**Post date:** [August 1, 2025, 9:32am UTC](https://discuss.ai.google.dev/t/gemini-live-api-wont-connect-from-local-computer/96334/5 "2025-08-01T09:32:24Z")

</div>

Hi @GUNAND_MAYANGLAMBAM , thanks for the reply. Someone actually figured out the issue on the google cloud forum, here is the link to that: [Gemini Live API handshake times out from local machine but works in cloud shell - Generative AI & Foundational Models - Google Developer forums](https://discuss.google.dev/t/gemini-live-api-handshake-times-out-from-local-machine-but-works-in-cloud-shell/247511)

I was using the wrong location. I don’t see why global works in the cloud shell but not locally though 😅.
