You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/star-173/llm_session/actions/workflows/publish.yml)
A zero-configuration tool to automate interactions with web-based LLM providers (currently ChatGPT). It handles authentication, session persistence, and chained prompt execution programmatically.
7
+
A zero-configuration tool to automate interactions with web-based LLM providers (**ChatGPT** and **Claude**). It handles authentication, session persistence, and chained prompt execution programmatically.
9
8
10
9
## Features
10
+
-**Multi-Provider Support**: Automate interactions with all ChatGPT, AIStudio and Claude (Anthropic).
11
11
-**Zero-Config Setup**: Automatically handles browser binaries via Playwright.
12
12
-**Session Persistence**: Reuses cookies/storage for subsequent runs (no need to login every time).
13
-
-**Smart OTP Handling**: Supports non-blocking callbacks for 2FA/OTP challenges.
14
13
-**Resilient**: Allows custom CSS selectors to adapt to UI changes without updating the library.
15
14
16
15
## Prerequisites
17
-
You must set the following environment variables, or pass them directly to the constructor:
18
-
-`CHATGPT_EMAIL`
19
-
-`CHATGPT_PASSWORD`
20
-
-`CHATGPT_GOOGLE_LOGIN` (Optional: set to "true" if using Google Auth. *Note: Google Auth is experimental and may require manual intervention.*)
16
+
You must set the following environment variables, or pass them directly to the constructor via the `credentials` dictionary.(Currently, Use google account only in order to login)
17
+
18
+
**Google Login:**
19
+
-`LLM_EMAIL`
20
+
-`LLM_PASSWORD`
21
21
22
22
## Disclaimer
23
23
> [!WARNING]
24
-
> **Cloudflare/Bot Detection**: Automated interactions with ChatGPT are subject to high-security bot detection (Cloudflare). This library uses standard browser automation and may be blocked. For production reliability, please use the Official OpenAI API.
24
+
> **Cloudflare/Bot Detection**: Automated interactions with web providers are subject to high-security bot detection. This library uses standard browser automation and may be blocked. For production reliability, please use the Official OpenAI or Anthropic APIs.
25
25
26
26
This tool automates a third-party web interface. It is subject to breakage if the target website changes its DOM structure. Use responsibly and in accordance with the provider's Terms of Service.
27
27
@@ -44,19 +44,18 @@ from llm_session import Automator
44
44
# 1. Configure Standard Logging
45
45
logging.basicConfig(level=logging.INFO)
46
46
47
-
# 2. Define OTP Callback (Optional, but recommended for headless envs)
47
+
# 2. Define OTP Callback (Optional)
48
48
defmy_otp_handler():
49
-
# In production, you might fetch this from an email API
50
49
returninput("Enter OTP Code sent to email: ")
51
50
52
-
# 3. Initialize
51
+
# 3. Initialize (Select 'chatgpt' or 'claude')
53
52
bot = Automator(
54
-
provider="chatgpt",
55
-
headless=False, # Set to True for production (CURRENTLY ONLY WORKS WITH headless=False)
53
+
provider="claude", # Options: "chatgpt", "claude"
54
+
headless=False, # Set to True for headless mode (may increase detection risk)
56
55
credentials={
57
56
"email": "your_email@example.com",
58
57
"password": "your_password",
59
-
"method": "email"#or "google"
58
+
"method": "google"#Claude provider defaults to Google Auth flows
60
59
},
61
60
on_otp_required=my_otp_handler
62
61
)
@@ -81,7 +80,7 @@ bot.close()
81
80
82
81
### Custom Selectors
83
82
84
-
Websites change their layout often. If ChatGPT updates their CSS class names, you don't need to wait for a package update. You can inject your own selectors during initialization.
83
+
Websites change their layout often. If a provider updates their CSS class names, you don't need to wait for a package update. You can inject your own selectors during initialization.
85
84
86
85
```python
87
86
bot = Automator(
@@ -103,25 +102,26 @@ Instead of passing credentials directly, you can use environment variables:
This library stores browser cookies and local storage in your OS's standard user data directory:
115
+
This library stores browser cookies and local storage in your OS's standard user data directory. This allows the browser to maintain a "Logged In" state between script executions.
- Check if you have 2FA enabled (provide `on_otp_required` callback)
268
-
-Try logging in manually in a browser first to ensure your account is accessible
195
+
- Verify your email and password.
196
+
- Check if you have 2FA enabled (provide `on_otp_required` callback).
197
+
-**Claude Users**: If using Google Auth, ensure the browser window (non-headless) allows you to click through any security prompts initially.
269
198
270
199
### Issue: "Cloudflare challenge detected"
271
200
**Solution**:
272
-
- This library uses standard browser automation which may be detected
273
-
- Try running with `headless=False` to solve CAPTCHA manually
274
-
- For production use, consider using the official OpenAI API instead
201
+
- This library uses standard browser automation which may be detected.
202
+
- Try running with `headless=False` to solve CAPTCHA manually.
275
203
276
-
### Issue: Selectors not working after ChatGPT update
277
-
**Solution**:
278
-
- Use the custom selectors feature to update CSS selectors
279
-
- Or wait for a library update with fixed selectors
280
-
- Check GitHub issues for community-reported solutions
204
+
### Issue: Popup not closing (Claude/Google Auth)
205
+
**Solution**:
206
+
- The library attempts to handle Google's "Continue" interstitial screens. If it gets stuck, manual intervention in `headless=False` mode usually fixes the session for future headless runs.
281
207
282
208
### Issue: Session not persisting
283
209
**Solution**:
284
-
- Ensure the session directory has write permissions
285
-
- Check if antivirus is blocking file writes
286
-
- Try specifying a custom `session_path` with known write access
210
+
- Ensure the session directory has write permissions.
211
+
- Check if antivirus is blocking file writes.
287
212
288
213
---
289
214
@@ -299,12 +224,4 @@ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guid
299
224
300
225
## License
301
226
302
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
0 commit comments