A Streamlit app that lets you ask both Claude and ChatGPT the same question at once, share attachments with both, and (optionally) let them see each other's reasoning and revise their answers. You can also add your own opinion that both models will consider.
- Single prompt, two models — type once, both Claude and ChatGPT answer.
- Attachments — upload PDFs, images, or text files once; both models see them.
- Your opinion — optional text box for context you want both AIs to consider.
- Debate rounds — let each model see the other's answer and revise (0–3 rounds).
- Conversation history — follow-up questions remember earlier turns.
git clone <your-repo-url>
cd dual_ai_appUse Python 3.10 or newer.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtYou have two options:
Option A — secrets file (recommended):
mkdir -p .streamlit
cp .streamlit/secrets.toml.example .streamlit/secrets.toml
# Then edit .streamlit/secrets.toml and paste your real keys.Option B — paste them in the sidebar each session.
Get keys here:
- Anthropic: https://console.anthropic.com/ (Settings → API Keys)
- OpenAI: https://platform.openai.com/api-keys
Both require a small prepaid balance — $5–10 is plenty to start.
streamlit run app.pyYour browser will open at http://localhost:8501.
-
Push this folder to a GitHub repository (the included
.gitignorekeeps yoursecrets.tomlout of git — verify before pushing). -
Go to https://share.streamlit.io and sign in with GitHub.
-
Click New app, pick your repo, and set the main file to
app.py. -
Under Advanced settings → Secrets, paste:
ANTHROPIC_API_KEY = "sk-ant-..." OPENAI_API_KEY = "sk-..."
-
Deploy. You'll get a public URL like
https://your-app.streamlit.app.
If you want the app private, set the app to private in Streamlit Cloud settings (requires a paid plan) or just keep using it locally.
- Claude model — defaults to
claude-opus-4-7(most capable). Switch toclaude-sonnet-4-6for cheaper, faster answers. - OpenAI model — defaults to
gpt-5.5. Usegpt-5.4-minifor cheaper runs. - Debate rounds — 0 means just show both initial answers. 1 means each model gets to see the other's answer once and revise. Higher = deeper back-and-forth.
Each "ask both" sends two API calls (one per model). Each debate round adds two more. Rough order of magnitude for a typical chat-length question with no attachments: a fraction of a cent per round on the cheap models, a few cents on the top-tier models. Big PDFs/images cost more (more input tokens).
- Images (
.png,.jpg,.gif,.webp) — both models see them natively. - PDFs — both models read them natively.
- Word documents (
.docx) — text is extracted (paragraphs + tables) before sending. - Excel spreadsheets (
.xlsx) — cell values are extracted, sheet by sheet. - PowerPoint (
.pptx) — slide text is extracted. - Text-like files (
.txt,.md,.csv, code files) — inlined as text.
Legacy binary Office formats (.doc, .xls, .ppt) are not supported — re-save
them as the modern Office format or export to PDF. Other unknown binary files
will be flagged with a warning rather than dumped as garbage into the prompt.
- "API error: invalid_api_key" — double-check the key, no extra spaces.
- "insufficient_quota" — top up your balance at platform.openai.com or console.anthropic.com.
- Model not found — model names change. Check
https://docs.claude.com/en/docs/about-claude/models and
https://platform.openai.com/docs/models and update the names in the sidebar
dropdowns in
app.py.