revGrok is an unofficial implementation that allows you to interact with Grok’s API in reverse.
To use this library, follow these simple steps:
-
Install the package:
pip install -U revgrok
-
Obtain your authentication cookie:
- Log in to the Grok web app and start any conversation.
- Record the cookie value from your browser.

-
Use the library: A simple example script, chat_example.py, demonstrates how to interact with Grok.
import asyncio
from revgrok import GrokClient
async def main():
cookie = "Your cookie here" # Replace with your actual cookie
model = "grok-3" # Choose your model (e.g., grok-3)
prompt = "9.8 and 9.11, which is bigger?" # Define your prompt
client = GrokClient(cookie=cookie)
async for response in client.chat(prompt=prompt, model=model, reasoning=False):
print(response, end="")
if __name__ == "__main__":
asyncio.run(main())- Set
reasoning=Trueif you want to enable reasoning or leave it asFalseto disable it. - For free accounts, your usage may soon be limited. Consider upgrading to a paid plan to avoid interruptions.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request!