Skip to main content
Several people share one deployment and each spends their own SuperGrok subscription. The token is stored under the user_id the run carries, and the xAI model resolves that user’s token per request, so two users on the same agent never share a credential.
oauth_multi_user.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_multi_user.py, then run:
Full source: cookbook/90_models/xai/oauth_multi_user.py