Skip to main content
Sign in with a SuperGrok subscription from inside the conversation. Two agents share one token manager: a sign-in agent carries the XAIAuth toolkit and walks the user through the approval link, and a Grok agent spends the subscription once the sign-in lands. Use this shape for chatbots and web UIs, where the terminal device flow in oauth_device_login.py will not work.
oauth_chat_signin.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Run the example

Save the code above as oauth_chat_signin.py, then run:
Full source: cookbook/90_models/xai/oauth_chat_signin.py