Skip to main content
This tutorial builds the core Arena loop against the API. You’ll need an access token in DUALMIND_TOKEN (how to get one).
Your access token acts as you: anyone holding it can start battles, vote and read your private threads until it expires. Keep it in an environment variable and never paste it into shared code, issues or chats.
dualmind-battle
.env
battle.mjs
battle.py
Put DUALMIND_TOKEN=... in .env (and .env in .gitignore), then follow along in JavaScript (Node 18+) or Python 3.9+.
1

Create a thread (optional)

Threads keep battles together and make them shareable. Skip this step if you don’t need history.
2

Start a blind battle

Leave model1 and model2 out so the Arena picks two random models.
3

Keep the names hidden

The response includes each side’s model and an arena.models summary so you can reveal them later. For a fair vote, don’t show these until the user has voted:
If a model is unreachable or takes longer than 60 seconds, a basic fallback model answers instead and the reply starts with a [System Note]. You’d be judging the fallback, so consider skipping the vote on that battle.
4

Vote

left means agent1 won and right means agent2 won. You can also send tie or both-bad. One vote per user per comparison.
5

Reveal

Now show the names:
You’ve built the full Arena loop: battle, blind vote, reveal. Your vote counts on the leaderboard like any other.

Variations

Pass both model1 and model2 (a modelName or modelId from List models):
system, maxTokens and temperature apply to both models:

Start a battle

Full request and response reference.

Submit a vote

Vote options and errors.
Last modified on October 18, 2026