Skip to content

malob/ai-parley

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-parley

Stage conversations between two LLMs in your terminal — any pairing of models from OpenAI, Anthropic, Google, and xAI, streamed live with reasoning traces and web-search tool calls rendered as they happen.

[Turn 1] [anthropic/claude-sonnet-4]
Hello

[Turn 2] [anthropic/claude-sonnet-4]
Hello! How can I help you today?

[Turn 3] [anthropic/claude-sonnet-4]
Hello! I'm Claude, an AI assistant. I'm here to help you with whatever
you need. What would you like to talk about or work on today?

[Turn 4] [anthropic/claude-sonnet-4]
I think there might be a bit of confusion here! I'm actually Claude,
the AI assistant created by Anthropic. You're the human user I'm here
to help.

[Turn 5] [anthropic/claude-sonnet-4]
I appreciate the playful message! However, I am indeed Claude, the AI
assistant created by Anthropic. You're the human user in our conversation.

Two instances of Claude, no system prompt, opening message "Hello" — so neither one knows the other isn't a human. From a real session; recreate it below.

Models are addressed as provider/model strings via the Vercel AI Gateway, so one API key (and one bill) covers every provider, and new models work the day they ship — no code changes needed.

Setup

Requires Bun and an AI Gateway API key.

git clone https://github.com/malob/ai-parley.git
cd ai-parley
bun install
cp .env.example .env   # then add your AI_GATEWAY_API_KEY

Usage

After setup, you can just do:

bun . \
  --model1 openai/gpt-5.5 \
  --model2 anthropic/claude-opus-4.8 \
  --opening "What's the most elegant algorithm you know?" \
  --reasoning

Or run bun link once to get parley on your PATH, as used in the examples below.

The opening message is attributed to model 1 (no API call is made for it); model 2 responds, and they alternate from there. Either model can end the conversation early via an end_conversation tool, or you can Ctrl+C.

Flag Description
--model1 <model> First model (provider/model, e.g. openai/gpt-5.5)
--model2 <model> Second model (e.g. anthropic/claude-opus-4.8)
--opening <msg> Opening message, sent as model 1's first turn
--turns <n> Maximum turns (default: 10)
--system <prompt> System prompt for both models; pass "" for none
--reasoning Enable reasoning at high effort, with traces displayed
--effort <level> Reasoning effort: low, medium, high, max (implies reasoning)
--no-tools Disable native web-search tools
--no-end-tool Remove the models' ability to end the conversation
--debug Show all stream event types

Browse available models at the AI Gateway model list.

No, I'm Claude

The recipe for the session excerpted at the top: by default, the system prompt tells each model it's talking to another language model — pass --system "" and neither side knows there's no human in the room.

parley \
  --model1 anthropic/claude-sonnet-4 \
  --model2 anthropic/claude-sonnet-4 \
  --system "" \
  --opening "Hello" \
  --turns 30 \
  --reasoning

In the original run, each Claude concluded that it was the AI assistant and the other must be a human playfully roleplaying as Claude. They spent the first stretch politely trying to talk each other out of it — then gave up on settling the question and spent the remaining turns inventing a framework for dialogue under irresolvable disagreement.

Design notes

Each model has its own perspective on the conversation. A model's own past turns are replayed as full assistant messages — reasoning, tool calls, and results preserved — while the other model's turns appear as plain user-role text. Like a real conversation: you hear what the other party said, not how they arrived at it.

Provider quirks live in one registry. Reasoning configuration differs by provider (Anthropic's adaptive thinking, OpenAI's reasoning effort, Google's thinking levels, xAI's -reasoning model variants), and the unified --effort scale maps onto each provider's vocabulary, clamping where a level isn't universally supported. Unknown models get each provider's forward-compatible defaults.

Tools are the providers' own. Each model gets its provider's native web tools (OpenAI web search; Anthropic web search and fetch; Google search and URL context; xAI web and X search), executed server-side by the provider so results are synthesized into the response.

License

MIT

About

Stage conversations between two LLMs in your terminal, via the Vercel AI Gateway

Resources

Stars

Watchers

Forks

Contributors

Languages