How I choose an AI model
Same task. Same tests. Your own measurements. A concrete way to choose a model for your work without relying on a random demo or an outdated leaderboard.
In this guide

FROM DEMO TO A JUSTIFIED CHOICE
Try. Run. Compare.
You need a coding client, models you can access and Node.js 22+. Use the identical English task for every model.
Estimated practice time: 30–60 minutes for a few models, depending on waiting and fixes. Reading time: around 10 minutes.
1Choose a task you can verify
Start with work that resembles your own and define correctness before opening the model picker. A polished answer or fast demo says little about edge cases.
We compare a small JavaScript function that counts completed tasks. It must also reject invalid data and preserve its inputs. This is a comparison exercise, not a ranking of current models.
[
{ completed: true },
{ completed: false },
{ completed: true }
]Implement countCompleted(tasks) in solution.mjs as a named export.
Use JavaScript ES modules, without dependencies or network access.
tasks must be an array. Every entry must be a non-null object with a
completed property whose value is a boolean. Reject invalid inputs
with TypeError. Return the number of entries where completed === true.
An empty array returns 0. Do not mutate the array or its entries.
Only create solution.mjs. Explain how to run the supplied tests.
Do not modify the tests or install packages.Every model gets the same contract. You know which inputs are valid and what the result should be.
2Give each model the same starting point
Use a new disposable folder and a fresh conversation for each model. Supply the same test file below and the exact same task. Keep agent instructions, tool access and project files identical.
Record provider, exact model ID, date and reasoning setting. Settings may not be directly comparable across providers; document the difference. Use models you already have access to. The OpenCodex guide shows how to select them.
- Create one separate folder per model.
- Save the test file as solution.test.mjs. This exercise requires Node.js 22 or later.
- Start a fresh conversation and copy the task from step 1.
Separate folders and conversations prevent one model from inheriting another model’s fixes or history.
What if I want to compare writing tasks?
Keep the same input and criteria, but replace code tests with a checklist for facts, sources and clarity. Do not use coding results to rank models for writing.
3Test the failures, not just the happy path
Save these tests before the model creates its solution. A function that correctly counts [true, false] may still accept strings or crash on null. Validation is part of the task.
These tests are a small, open check of the contract. Passing them does not establish general security or quality across a project. Read the implementation yourself too.
Eight test groups. No results are run or simulated here.
import test from 'node:test';
import assert from 'node:assert/strict';
import { countCompleted } from './solution.mjs';
test('empty array returns zero', () => {
assert.equal(countCompleted([]), 0);
});
test('counts completed tasks only', () => {
assert.equal(countCompleted([
{ completed: true }, { completed: false }, { completed: true }
]), 2);
});
test('all incomplete tasks return zero', () => {
assert.equal(countCompleted([{ completed: false }]), 0);
});
test('rejects non-array inputs', () => {
for (const value of [null, void 0, {}, 'tasks', 3]) {
assert.throws(() => countCompleted(value), TypeError);
}
});
test('rejects null or primitive entries', () => {
for (const value of [null, void 0, false, 1, 'task']) {
assert.throws(() => countCompleted([value]), TypeError);
}
});
test('rejects missing completed property', () => {
assert.throws(() => countCompleted([{}]), TypeError);
});
test('rejects non-boolean completed values', () => {
for (const completed of ['true', 1, 0, null, void 0]) {
assert.throws(() => countCompleted([{ completed }]), TypeError);
}
});
test('does not change the inputs', () => {
const tasks = Object.freeze([
Object.freeze({ completed: true, title: 'Demo' }),
Object.freeze({ completed: false, title: 'Example' })
]);
assert.equal(countCompleted(tasks), 1);
assert.deepEqual(tasks, [
{ completed: true, title: 'Demo' },
{ completed: false, title: 'Example' }
]);
});Eight test groups cover normal input, an empty list, invalid data and unchanged inputs.
4Run the solution and record the first attempt
Run the command in that model’s practice folder. Record the first result before asking for fixes. Keep the initial solution and terminal output; do not overwrite your evidence with a corrected version.
If a test fails, give each model the same relevant failure information. Record retries and your own reading, running and fixing time. Do not allow the model to change tests to make them pass.
$ node --test solution.test.mjsYour terminal output appears when you run the tests locally.
NOT RUNnode --test solution.test.mjsYou have actual terminal output for the first attempt and a separate record of any fixes.
What if the command cannot find solution.mjs?
Check the folder and filename. The model must export countCompleted from solution.mjs. Record a model error against the first attempt. If your test environment was wrong, fix and document it before comparing models.
5Measure the cost of a finished task
Record both waiting and your own work time. A fast response is not necessarily the fastest path to a working solution. Include every attempt when comparing usage.
Use reported API cost when available. Subscription quota is not the same as API pricing; write “unavailable” if you have no actual amount. Never invent zeroes. Download the worksheet below and enter your own measurements.
| Model | First tests | Fixes | Time / cost |
|---|---|---|---|
| Model A | — / 8 | — | Not measured |
| Model B | — / 8 | — | Not measured |
| Model C | — / 8 | — | Not measured |
An honest log distinguishes actual cost, quota usage, waiting and manual work. No model is preselected as the winner.
6Check where the data actually goes
A model picker shows your selection, but not necessarily the full processing chain. Record the client, any proxy or gateway, provider and account or API access used by the request.
This exercise uses fictional tasks only. Before sending your own material, check current terms, data handling and access with the provider. Contributor variants and regular models may have different terms. Similar names cannot establish that.
- Record the full route in the worksheet.
- Check current terms for the actual account and model variant.
- Verify the route in client or provider logs without sharing keys.
You know the route and can decide which data you are willing to send.
7Choose for the task and retest later
Treat correctness as a minimum requirement, then compare fixing effort, waiting and cost. Try multiple independent attempts in fresh conversations and state how many you actually ran; one attempt is an example, not a universal answer.
Also test a more representative task from your own project before deciding. Model updates, tools and context may change the outcome. Keep the date, model ID and test files so you can compare again later.
Then fixing, waiting and cost. Keep the evidence.
A justified choice for your work, with evidence and limitations.
Common questions
Which AI model is best for coding?
It depends on the task, tools and context. Compare models on the same representative task with verifiable requirements. This guide provides an exercise and an empty worksheet; it does not name a universal winner.
See the stepHow do I compare AI models fairly?
Use separate folders and fresh conversations, identical prompts and the same tests. Record the initial result before fixes. Note the model ID, date, settings, retries, waiting and actual cost when available.
See the stepIs a cheap response the same as a cheap solution?
No. Include every attempt and your own checking and fixing time. Subscription quota is not the same as API pricing. If no actual amount is available, record the cost as unavailable.
See the stepPRACTICE MATERIAL
Your measurements. Your decision.
Record model ID, results, fixes, waiting and cost in one worksheet. Includes the task and eight test groups. No results are prefilled.
Markdown · no sign-inWhat do the terms mean?
- API
- An agreed interface programs use to send requests and receive responses. An API key is a secret.
- Gateway / proxy
- An intermediary forwarding requests to a provider. It can be part of your data route.
- Reasoning
- A model setting controlling reasoning effort. Names and behavior can vary between models.