Skip to content

ChatGPT Guide

First-time setup

Run setup once before using ChatGPT. This builds a persistent browser profile that reduces bot detection risk:

from hermex import ChatGPT

ChatGPT.setup()

Browse around briefly, then close the window. Login is optional — ChatGPT works without it for all features including image upload.

Basic text query

from hermex import ChatGPT

chatgpt = ChatGPT()
chatgpt.open_url()

response = chatgpt.query("Summarize the plot of Dune in three sentences.")
print(response.text)

chatgpt.close()

Uploading images

ChatGPT supports image upload without requiring a logged-in session. Supported formats: .jpg, .jpeg, .png.

response = chatgpt.query(
    "Extract all the text from this image.",
    images=["receipt.jpg"],
)
print(response.text)

Multiple images:

response = chatgpt.query(
    "What are the differences between these two screenshots?",
    images=["before.png", "after.png"],
)

Getting generated images

When ChatGPT generates an image, Hermex downloads it automatically:

response = chatgpt.query("Generate a logo for a coffee shop called 'Morning Brew'.")
if response.image:
    print(f"Image saved to: {response.image}")

ChatGPT does not watermark generated images.

Getting markdown

Pass get_markdown=True to get the raw markdown source instead of plain text:

response = chatgpt.query(
    "Give me a markdown cheatsheet.",
    get_markdown=True,
)
print(response.text)

Long messages

Use paste=True for long prompts to avoid slow character-by-character typing:

response = chatgpt.query(long_prompt, paste=True)

Hermex types dummy text first by default (fake_typing=True) before pasting to look more human. Disable if needed:

response = chatgpt.query(long_prompt, paste=True, fake_typing=False)

Multi-turn conversation

Each query() call appends to the existing conversation thread:

chatgpt.open_url()

chatgpt.query("Act as a senior Python developer reviewing my code.")
response = chatgpt.query("Here's my function: ...")
print(response.text)

response = chatgpt.query("How would you refactor it?")
print(response.text)

One-shot scripts

from hermex import ChatGPT

response = ChatGPT.simple_query(
    "What does this error mean?",
    images=["traceback.png"],
)
print(response.text)

Constructor options

chatgpt = ChatGPT(
    download_dir="outputs/",   # where to save generated images
    headless=False,            # set True to run without a visible window
    typing_delay=0.025,        # seconds between keystrokes (default 0.025)
    data_dir=None,             # override the default data directory
)

Warning

Avoid headless=True for sessions where bot detection is a concern. A visible browser is significantly harder to detect.