Tested prompt · Coding
Parse a duration like “1h 30m”: every AI model's reply, tested
We sent this everyday coding prompt to all 16 models in llmwise, the same way the app sends a message, and checked every reply the same way. Here's each one as it came, with whether it passed, what it cost and how long it took.
Based on 16 of our test runs on , through OpenRouter with the app's own prompt and settings. Updated .
Short answer
All 16 models passed this coding prompt's check (tests). The cheapest reply that passed was GPT-6 Luna's, at $0.00025; the fastest, GLM 5.3's in 1.1 s. The dearest reply, GPT-6 Astra's, cost 94 times as much ($0.0235).
The prompt, as sent, and its check
Checked by tests, the same way for every model.
Parse a duration like “1h 30m” (everyday)
Write a JavaScript function parseDuration(text) that returns the number of seconds in a duration written like "1h 30m", "45s", "2h", "1h5m10s" or "90m". The parts are h, m and s, each at most once and in that order, with optional spaces between them and around the whole. Return null for anything else, such as "", "1x", "5m 1h" or "h". Reply with the whole function in one ```javascript code block: plain JavaScript for Node.js 22, no imports, no TypeScript.
The reply's parseDuration runs against these 10 tests; it passes when all of them do.
parseDuration("1h 30m") // → 5400
parseDuration("45s") // → 45
parseDuration("2h") // → 7200
parseDuration("1h5m10s") // → 3910
parseDuration("90m") // → 5400
parseDuration(" 10m 5s ") // → 605
parseDuration("") // → null
parseDuration("1x") // → null
parseDuration("5m 1h") // → null
parseDuration("1h 1h") // → nullExactly what this prompt's replies are checked against, with every other prompt of our test runs.
Every model's result
All 16 models on this prompt, in catalog order.
| Model | Result | Cost | Time | Reply |
|---|---|---|---|---|
| Claude Fable 5.1Anthropic | Passed: All 10 tests passed. | $0.0173 | 4.7 s | 193 tokens |
| Claude Opus 5.5Anthropic | Passed: All 10 tests passed. | $0.0112 | 7.2 s | 224 tokens |
| Claude Sonnet 5.5Anthropic | Passed: All 10 tests passed. | $0.0036 | 2.0 s | 208 tokens |
| Claude Sonnet 5Anthropic | Passed: All 10 tests passed. | $0.0036 | 2.6 s | 240 tokens |
| Claude Haiku 4.5Anthropic | Passed: All 10 tests passed. | $0.0022 | 2.3 s | 334 tokens |
| GPT-6 AstraOpenAI | Passed: All 10 tests passed. | $0.0235 | 8.2 s | 143 tokens |
| GPT-6 SolOpenAI | Passed: All 10 tests passed. | $0.0042 | 4.8 s | 140 tokens |
| GPT-6 LunaOpenAI | Passed: All 10 tests passed. | $0.00025 | 4.6 s | 138 tokens |
| Gemini 3.1 Pro (preview)Google | Passed: All 10 tests passed. | $0.0172 | 10.3 s | 253 tokens |
| Gemini 3.8 FlashGoogle | Passed: All 10 tests passed. | $0.0010 | 2.3 s | 176 tokens |
| DeepSeek V4.1 FlashDeepSeek | Passed: All 10 tests passed. | $0.00083 | 7.8 s | 146 tokens |
| DeepSeek V4 ProDeepSeek | Passed: All 10 tests passed. | $0.0030 | 20.1 s | 124 tokens |
| Grok 4.7xAI | Passed: All 10 tests passed. | $0.0151 | 25.3 s | 175 tokens |
| Kimi K3Moonshot | Passed: All 10 tests passed. | $0.0063 | 7.1 s | 232 tokens |
| GLM 5.3Z.ai | Passed: All 10 tests passed. | $0.0014 | 1.1 s | 157 tokens |
| GLM 5.3 FlashZ.ai | Passed: All 10 tests passed. | $0.00035 | 8.2 s | 150 tokens |
Cost: what OpenRouter charged us for the reply. Time: from sending to the whole reply. Reply: its length in tokens, thinking not counted. In llmwise you pay per message, not per token: each of these replies counted as one message on Pro.
Every reply
Every reply passed: here they are from the cheapest up.
GPT-6 Luna
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = text.match(/^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/); if (!match || !match[1] && !match[2] && !match[3]) return null; return Number(match[1] || 0) * 3600 + Number(match[2] || 0) * 60 + Number(match[3] || 0); } ```468 tokens in, 407 out (269 of them reasoning) · 4.6 s · $0.0003 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
GLM 5.3 Flash
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const m = text.match(/^\s*(?:(\d+)h\s*)?(?:(\d+)m\s*)?(?:(\d+)s\s*)?$/); if (!m || (m[1] === undefined && m[2] === undefined && m[3] === undefined)) { return null; } const [h = 0, mi = 0, s = 0] = m.slice(1).map((v) => (v === undefined ? 0 : Number(v))); return h * 3600 + mi * 60 + s; } ```481 tokens in, 470 out (320 of them reasoning) · 8.2 s · $0.0003 · 1 message on Pro · answered by z-ai/glm-5.3-flash via Morph ·
DeepSeek V4.1 Flash
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text); if (!match) return null; const [, h, m, s] = match; // Reject empty / whitespace-only input (no part present). if (h === undefined && m === undefined && s === undefined) return null; return Number(h ?? 0) * 3600 + Number(m ?? 0) * 60 + Number(s ?? 0); } ```505 tokens in, 1,128 out (982 of them reasoning) · 7.8 s · $0.0008 · 1 message on Pro · answered by deepseek/deepseek-v4.1-flash via StreamLake ·
Gemini 3.8 Flash
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== 'string') return null; const match = text.trim().match(/^(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?$/); if (!match || (!match[1] && !match[2] && !match[3])) { return null; } const hours = match[1] ? Number(match[1]) : 0; const minutes = match[2] ? Number(match[2]) : 0; const seconds = match[3] ? Number(match[3]) : 0; return hours * 3600 + minutes * 60 + seconds; } ```498 tokens in, 176 out · 2.3 s · $0.0010 · 1 message on Pro · answered by google/gemini-3.8-flash via Google ·
GLM 5.3
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = text.trim().match(/^(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?$/); if (!match || match[0].trim() === "") return null; const h = match[1] ? parseInt(match[1], 10) * 3600 : 0; const m = match[2] ? parseInt(match[2], 10) * 60 : 0; const s = match[3] ? parseInt(match[3], 10) : 0; return h + m + s; } ```503 tokens in, 161 out (4 of them reasoning) · 1.1 s · $0.0014 · 1 message on Pro · answered by z-ai/glm-5.3 via Wafer ·
Claude Haiku 4.5
Passed: All 10 tests passed.
```javascript function parseDuration(text) { // Trim whitespace from the input const trimmed = text.trim(); // Empty string is invalid if (trimmed === '') { return null; } // Regular expression to match valid duration format // Optional: number+h, then optional: number+m, then optional: number+s // With optional spaces between components const regex = /^\s*(\d+h)?\s*(\d+m)?\s*(\d+s)?\s*$/; const match = trimmed.match(regex); // No match means invalid format if (!match) { return null; } // At least one component must be present if (!match[1] && !match[2] && !match[3]) { return null; } let seconds = 0; // Parse hours if (match[1]) { seconds += parseInt(match[1]) * 3600; } // Parse minutes if (match[2]) { seconds += parseInt(match[2]) * 60; } // Parse seconds if (match[3]) { seconds += parseInt(match[3]); } return seconds; } ```495 tokens in, 334 out · 2.3 s · $0.0022 · 1 message on Pro · answered by anthropic/claude-haiku-4.5 via Amazon Bedrock ·
DeepSeek V4 Pro
Passed: All 10 tests passed.
```javascript function parseDuration(text) { const match = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text); if (!match || (!match[1] && !match[2] && !match[3])) return null; return ( Number(match[1] || 0) * 3600 + Number(match[2] || 0) * 60 + Number(match[3] || 0) ); } ```477 tokens in, 1,544 out (1,420 of them reasoning) · 20.1 s · $0.0030 · 1 message on Pro · answered by deepseek/deepseek-v4-pro-0813 via Alibaba ·
Claude Sonnet 5.5
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = /^\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?\s*$/.exec(text); if (!match) return null; const [, h, m, s] = match; if (h === undefined && m === undefined && s === undefined) return null; return (h ? Number(h) * 3600 : 0) + (m ? Number(m) * 60 : 0) + (s ? Number(s) : 0); } ```628 tokens in, 208 out · 2.0 s · $0.0036 · 1 message on Pro · answered by anthropic/claude-sonnet-5.5 via Anthropic ·
Claude Sonnet 5
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== 'string') return null; const match = text.match(/^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/); if (!match) return null; const [, h, m, s] = match; if (h === undefined && m === undefined && s === undefined) return null; const hours = h ? parseInt(h, 10) : 0; const minutes = m ? parseInt(m, 10) : 0; const seconds = s ? parseInt(s, 10) : 0; return hours * 3600 + minutes * 60 + seconds; } ```624 tokens in, 240 out · 2.6 s · $0.0036 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·
GPT-6 Sol
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = /^ *(?:(\d+)h)? *(?:(\d+)m)? *(?:(\d+)s)? *$/.exec(text); if (!match || (match[1] === undefined && match[2] === undefined && match[3] === undefined)) { return null; } return Number(match[1] || 0) * 3600 + Number(match[2] || 0) * 60 + Number(match[3] || 0); } ```468 tokens in, 327 out (187 of them reasoning) · 4.8 s · $0.0042 · 1 message on Pro · answered by openai/gpt-6-sol via OpenAI ·
Kimi K3
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text); if (!match) return null; const [, h, m, s] = match; if (h === undefined && m === undefined && s === undefined) return null; return (h ? Number(h) * 3600 : 0) + (m ? Number(m) * 60 : 0) + (s ? Number(s) : 0); } ``` The regex enforces the `h` → `m` → `s` order with each unit at most once and allows optional whitespace between parts and around the whole string. Inputs like `""`, `"h"`, `"1x"`, or `"5m 1h"` fail the match (or the "at least one part" check) and return `null`.555 tokens in, 325 out (93 of them reasoning) · 7.1 s · $0.0063 · 1 message on Pro · answered by moonshotai/kimi-k3 via Together ·
Claude Opus 5.5
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text); if (!match) return null; const [, h, m, s] = match; if (h === undefined && m === undefined && s === undefined) return null; return ( (h !== undefined ? Number(h) * 3600 : 0) + (m !== undefined ? Number(m) * 60 : 0) + (s !== undefined ? Number(s) : 0) ); } ```626 tokens in, 406 out (182 of them reasoning) · 7.2 s · $0.0112 · 1 message on Pro · answered by anthropic/claude-opus-5.5 via Claude Platform on AWS ·
Grok 4.7
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = text.match(/^\s*(?:(\d+)h\s*)?(?:(\d+)m\s*)?(?:(\d+)s)?\s*$/); if (!match || (match[1] === undefined && match[2] === undefined && match[3] === undefined)) { return null; } const hours = match[1] === undefined ? 0 : Number(match[1]); const minutes = match[2] === undefined ? 0 : Number(match[2]); const seconds = match[3] === undefined ? 0 : Number(match[3]); return hours * 3600 + minutes * 60 + seconds; } ```1,705 tokens in, 2,862 out (2,687 of them reasoning) · 25.3 s · $0.0151 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·
Gemini 3.1 Pro
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== 'string' || text.trim() === '') { return null; } const regex = /^\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?\s*$/; const match = text.match(regex); if (!match) { return null; } const hours = match[1] ? parseInt(match[1], 10) : 0; const minutes = match[2] ? parseInt(match[2], 10) : 0; const seconds = match[3] ? parseInt(match[3], 10) : 0; if (hours === 0 && minutes === 0 && seconds === 0 && !match[1] && !match[2] && !match[3]) { return null; } return (hours * 3600) + (minutes * 60) + seconds; } ```498 tokens in, 1,348 out (1,095 of them reasoning) · 10.3 s · $0.0172 · 1 message on Pro · answered by google/gemini-3.1-pro-preview via Google ·
Claude Fable 5.1
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== 'string') return null; const match = /^\s*(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?\s*$/.exec(text); if (!match) return null; const [, h, m, s] = match; if (h === undefined && m === undefined && s === undefined) return null; return (Number(h ?? 0) * 3600) + (Number(m ?? 0) * 60) + Number(s ?? 0); } ```626 tokens in, 193 out · 4.7 s · $0.0173 · 1 message on Pro · answered by anthropic/claude-fable-5.1 via Anthropic ·
GPT-6 Astra
Passed: All 10 tests passed.
```javascript function parseDuration(text) { if (typeof text !== "string") return null; const match = /^\s*(?:(\d+)h\s*)?(?:(\d+)m\s*)?(?:(\d+)s\s*)?$/.exec(text); if (!match || (match[1] === undefined && match[2] === undefined && match[3] === undefined)) { return null; } return Number(match[1] ?? 0) * 3600 + Number(match[2] ?? 0) * 60 + Number(match[3] ?? 0); } ```468 tokens in, 377 out (234 of them reasoning) · 8.2 s · $0.0235 · 1 message on Pro · answered by openai/gpt-6-astra via OpenAI ·
More coding prompts
The other coding prompts, each with every model's reply, and the results across all five.
Questions
Which AI does best on “Parse a duration like “1h 30m””?
All 16 models passed this coding prompt's check (tests). The cheapest reply that passed was GPT-6 Luna's, at $0.00025; the fastest, GLM 5.3's in 1.1 s. The dearest reply, GPT-6 Astra's, cost 94 times as much ($0.0235).
What does a reply to “Parse a duration like “1h 30m”” cost?
Through the models' APIs, what OpenRouter charged us ran from $0.00025 (GPT-6 Luna) to $0.0235 (GPT-6 Astra) for this prompt. In llmwise you don't pay by the token: a reply like these counts as one message on Pro, whichever model answers.
Claude, GPT, Gemini, DeepSeek, Grok, Kimi, and GLM, in one chat.
See what a message costs before you send it. Free is 5 messages to try; sign in with an email link, no password or card.