# Authentication issue with Google API key in Weaviate

**URL:** https://forum.weaviate.io/t/authentication-issue-with-google-api-key-in-weaviate/20276
**Category:** General
**Created:** [March 24, 2025, 11:45am UTC](https://forum.weaviate.io/t/authentication-issue-with-google-api-key-in-weaviate/20276 "2025-03-24T11:45:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Anushka\_Sonawane](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/anushka_sonawane/32/5755_2.png) [@Anushka\_Sonawane](https://forum.weaviate.io/u/Anushka_Sonawane)
#### Post date: [March 24, 2025, 11:45am UTC](https://forum.weaviate.io/t/authentication-issue-with-google-api-key-in-weaviate/20276/1 "2025-03-24T11:45:56Z")

</div>

I’m trying to use Google’s text vectorizer (`text2vec_google`) with Weaviate Cloud but encountering authentication issues. Despite providing the Google API key in headers, I’m getting a 401 error indicating invalid authentication credentials.

## Environment

- Weaviate Cloud instance
- Python client v4
- Using Google AI Studio API key

## Code

```python
import weaviate
import weaviate.classes as wc
from weaviate.classes.config import Property, DataType

# Connect to Weaviate
google_api_key = "my-google-api-key" # Actual key removed
headers = {
    "X-Goog-Studio-Api-Key": google_api_key, # Also tried X-Goog-Api-Key, X-Palm-Api-Key
}
weaviate_url = "https://my-instance.weaviate.cloud"  
weaviate_api_key = "my-weaviate-api-key" # Actual key removed

client = weaviate.connect_to_weaviate_cloud(
    cluster_url=weaviate_url,
    auth_credentials=weaviate.auth.AuthApiKey(weaviate_api_key),
    headers=headers
)

# Create collection with Google vectorizer
client.collections.create(
    name="KnowledgeUnit",
    properties=[
        wc.config.Property(name="chunks", data_type=wc.config.DataType.TEXT)
    ],
    vectorizer_config=wc.config.Configure.Vectorizer.text2vec_google(
        project_id="t1",
        model_id="textembedding-gecko@latest"
    )
)

Error message:

Google API Key: no api key found neither in request header: X-Palm-Api-Key or X-Goog-Api-Key or X-Goog-Vertex-Api-Key or X-Goog-Studio-Api-Key nor in environment variable under PALM_APIKEY or GOOGLE_APIKEY

What I've tried
Using different header formats: X-Goog-Api-Key, X-Goog-Studio-Api-Key.

Questions:
What is the correct header name to use for Google AI Studio API keys?
Is there a specific format required for the API key?
```

---

<div class="post-metadata">

### Author: ![maryannc](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/maryannc/32/3408_2.png) [@maryannc](https://forum.weaviate.io/u/maryannc)
#### Post date: [March 24, 2025, 11:12pm UTC](https://forum.weaviate.io/t/authentication-issue-with-google-api-key-in-weaviate/20276/2 "2025-03-24T23:12:40Z")

</div>

Hi @Anushka_Sonawane ,

Good Day!

Welcome to Weaviate Community!

Could you try using X-Palm-Api-Key as a workaround on this issue? Found this related threads below which could be related on this issue:

> [@Can't connect to Google Vertex](https://forum.weaviate.io/t/cant-connect-to-google-vertex/3254/7):
>
> I am faced with the same problem, but using X-Palm-Api-Key does not seem to work. Vertex AI is not compatible with API Keys anymore, hence I am trying Oauth2, service acc or simply an access token. EDIT: It now uploads the properties, but does not vectorize. My cluster is 1.25.10 and my python dependency client is 4.7.1. I am basically running these lines client = weaviate.connect\_to\_weaviate\_cloud( cluster\_url=os.getenv("WEAVIATE\_URL"), auth\_credentials=weaviate.auth.AuthApiKey(api…

> <https://github.com/weaviate/weaviate-python-client/issues/1086>
>
> \### How to reproduce this bug?
> 
> To reproduce, use \`X-Google-Vertex-Api-Key\` as… a header and a vertex model with the Python client.
> 
> \`\`\`python
> \# This call doesn't work
> client = weaviate.connect\_to\_local(
> headers={
> "X-Google-Vertex-Api-Key": VERTEX\_AI\_KEY, # this doesn't work 
> # "X-Google-Api-Key": VERTEX\_AI\_KEY, # this works
> "X-Google-Studio-Api-Key": AI\_STUDIO\_KEY,
> }
> )
> 
> 
> collection = client.collections.create(
> name="ExampleCollection",
> 
> # Define & configure the vectorizer module
> vectorizer\_config=\[
> Configure.NamedVectors.text2vec\_palm(
> name="content",
> source\_properties=\["title"\],
> model\_id="text-embedding-004",
> 
> api\_endpoint="generativelanguage.googleapis.com",
> project\_id="devrel-projects",
> ),
> 
> Configure.NamedVectors.multi2vec\_palm(
> name="poster",
> source\_properties=\["title"\],
> model\_id="textembedding-gecko@003",
> 
> location="us-central1",
> project\_id="devrel-projects"
> )
> \],
> )
> 
> \# this will fail
> collection.data.insert({ "title": "a lazy brown fox that doesn't jump, because he is lazy"})
> \`\`\`
> 
> \### What is the expected behavior?
> 
> It should be possible to pass Vertex key \`X-Google-Vertex-Api-Key\` as the header.
> 
> \### What is the actual behavior?
> 
> \`X-Google-Vertex-Api-Key\` is not recognised by the Google module
> 
> \### Versions
> 
> Weaviate: 1.24.14
> Client: 4.6.1

This seems to be a google module issue which keys are not recognized on google’s end. Let me know if this works for you!
