# Grok/Google API can not use in Cursor

**URL:** <https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987>\
**Category:** Bug Reports\
**Created:** [March 4, 2025, 7:58am UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987 "2025-03-04T07:58:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DwZhang01](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/dwzhang01/32/32646_2.png) [@DwZhang01](https://forum.cursor.com/u/DwZhang01)\
**Post date:** [March 4, 2025, 7:58am UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987/1 "2025-03-04T07:58:52Z")

</div>

I try to use Grok and Google/Gemini API in cursor, but it always gives me a big ‘INVALID API KEY’ when I click ‘Verify’. That’s terrible. Is there anyone encountering the same problem ?

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [March 4, 2025, 9:07am UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987/2 "2025-03-04T09:07:40Z")

</div>

Hey, could you share a screenshot?

---

<div class="post-metadata">

**Author:** ![DwZhang01](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/dwzhang01/32/32646_2.png) [@DwZhang01](https://forum.cursor.com/u/DwZhang01)\
**Post date:** [March 4, 2025, 1:06pm UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987/3 "2025-03-04T13:06:39Z")

</div>

Thanks for your attention !!!  
I have solved the problem of ‘INVALID API KEY’ which is caused by that I did’t uncheck the models that I have no api access (like gpt-4o, since I do not use an openai api) . However, when I switch to grok api, the following error occurs :  
{“code”:“Client specified an invalid argument”,“error”:“An empty message was provided. Every message needs at least one non-empty content element.”}  
I do have message in the text window. I do not know what’s wrong.

---

<div class="post-metadata">

**Author:** ![DwZhang01](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/dwzhang01/32/32646_2.png) [@DwZhang01](https://forum.cursor.com/u/DwZhang01)\
**Post date:** [March 4, 2025, 1:11pm UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987/4 "2025-03-04T13:11:17Z")

</div>

The api key is set correctly by default in the console and the base url has been changed to [https://api.x.ai/v1](https://api.x.ai/v1). And the model is grok-2.

---

<div class="post-metadata">

**Author:** ![DwZhang01](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/dwzhang01/32/32646_2.png) [@DwZhang01](https://forum.cursor.com/u/DwZhang01)\
**Post date:** [March 4, 2025, 1:28pm UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987/5 "2025-03-04T13:28:21Z")

</div>

All right. The problem is solved somehow when I change between Ask/Edit/Agent. It might be a client bug.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [April 3, 2025, 1:29pm UTC](https://forum.cursor.com/t/grok-google-api-can-not-use-in-cursor/58987/6 "2025-04-03T13:29:00Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
