Agent skill
Using ask-question CLI
Send prompts to ChatGPT via browser automation. Use this when you need to query ChatGPT from the command line or integrate with the /ask-question slash command.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/productivity/using-ask-question-cli-johnnymo87-chatgpt-relay
SKILL.md
Using ask-question CLI
Send prompts to ChatGPT via Playwright browser automation with headless operation.
Architecture
ask-question CLI ──► HTTP POST /ask ──► ask-question-server (daemon)
│
▼
Chromium (headless)
+ storageState session
│
▼
ChatGPT response
Prerequisites
- Node.js installed
- Playwright with Chromium (
npm installdownloads it) - npm link run in the chatgpt-relay directory
Setup (One-Time)
cd ~/Code/chatgpt-relay
npm install
npm link
ask-question-login # Opens browser, log into ChatGPT
Starting the Daemon
ask-question-server
Keep this running in a dedicated terminal or tmux pane. It runs headless (no visible browser).
Expected output:
[ask-question-server] Starting headless browser...
[ask-question-server] Using session: ~/.chatgpt-relay/storage-state.json
[ask-question-server] ChatGPT page opened (headless).
[ask-question-server] HTTP server listening on http://127.0.0.1:3033
Usage
Direct prompt
ask-question "What is the capital of France?"
From file
ask-question -f question.md -o answer.md
Pipe input
echo "Explain async/await in JavaScript" | ask-question
Options
| Option | Description |
|---|---|
-f, --file <path> |
Read prompt from file |
-o, --output <path> |
Write response to file |
-t, --timeout <ms> |
Response timeout (default: 1200000 / 20 min) |
--continue |
Continue existing chat (default: start new chat) |
-h, --help |
Show help |
Integration with /ask-question Slash Command
The /ask-question slash command in Claude Code uses this CLI:
- Claude drafts a Stack Exchange-formatted question
- Claude invokes:
ask-question -f question.md -o answer.md - CLI blocks while ChatGPT responds (typically 1-10 minutes)
- Claude reads the answer file and discusses
Use /ask-question draft topic to skip automation and just draft the question.
Troubleshooting
"Server not running or not responding"
Start the daemon:
ask-question-server
"No session found"
Run login helper:
ask-question-login
Session expired
ChatGPT sessions expire after a while. Re-run login:
ask-question-login
Response timeout
Default is 20 minutes. Adjust if needed:
# Shorter timeout for quick questions
ask-question -t 120000 "What is 2+2?"
# Longer timeout for complex responses
ask-question -t 1800000 "Write a comprehensive analysis..."
Environment Variables
| Variable | Default | Description |
|---|---|---|
ASK_QUESTION_SERVER_URL |
http://127.0.0.1:3033 |
Server URL |
ASK_QUESTION_PORT |
3033 |
Server port |
ASK_QUESTION_STORAGE_STATE_FILE |
~/.chatgpt-relay/storage-state.json |
Session file |
Files
| Path | Purpose |
|---|---|
~/.chatgpt-relay/storage-state.json |
Saved ChatGPT session (cookies/localStorage) |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?