---
title: "Build a React component from a spec: 7 AI models, one prompt | Straitly"
description: "Seven AI models built the same React TagInput from one spec. 11 Testing Library tests and strict tsc, plus time, tokens and cost per run."
url: https://straitly.ai/shootouts/react-component
updated: 2026-11-26
publisher: Straitly (https://straitly.ai)
---

# Build a React component from a spec: 7 AI models, one prompt

All 7 models passed all 11 checks, so speed and price decide. GPT-6.2 Astra wins: done in 3.5 s. Gemini 4 Carbon cost the least at the maker's list price, $0.0103\. Kimi K3.1 Pro took the longest, 206 s.

Updated 26 November 2026

[See the results](#results) [Read every output ](#outputs)

The task

Asked

Write a TagInput component in React and TypeScript from a written spec: add on Enter or comma, paste, no duplicates, Backspace, a tag limit and a label.

Graded by

11 Vitest and Testing Library tests, plus a strict tsc check

## Which model did best?

Every answer was run, not read. Here is who passed, how long each took and what each run cost.

- Pick this one
### GPT-6.2 Astra
11 of 11 checks, done in 3.5 s: the fastest full pass. $0.0269 at list price.
- Smallest bill
### Gemini 4 Carbon
11 of 11 checks for $0.0103 at list price, in 15.4 s.
- Biggest bill
### Claude Fable 5.2
11 of 11 checks too, at $0.161 at list price for the same result.
- Longest wait
### Kimi K3.1 Pro
Passed, after 206 s and 6,712 output tokens. Fine in a batch job, slow in an editor.
- Most tokens
### DeepSeek V4.1 Flash 1017
28.7K output tokens, 27.8K of them reasoning, for the same pass.

### Results

| Model                             | Tests      | First token | Total time | Output tokens | Reasoning | List cost | Straitly price                                                 |
| --------------------------------- | ---------- | ----------- | ---------- | ------------- | --------- | --------- | -------------------------------------------------------------- |
| Claude Opus 5.5 Anthropic         | Pass 11/11 | 3.9 s       | 28.5 s     | 3,090         | 1,674     | $0.0643   | [$0.0386](https://straitly.ai/models/claude-opus-5-5)          |
| GPT-6.2 Astra OpenAI              | Pass 11/11 | 1.8 s       | 3.5 s      | 589           | 0         | $0.0269   | [$0.0161](https://straitly.ai/models/gpt-6.2-astra)            |
| Gemini 4 Neon Google              | Pass 11/11 | 101 s       | 111 s      | 860           | 0         | $0.0142   | [See model page](https://straitly.ai/models/gemini-4-neon)     |
| Gemini 4 Carbon Google            | Pass 11/11 | 4.5 s       | 15.4 s     | 934           | 0         | $0.0103   | [$0.0103](https://straitly.ai/models/gemini-4-carbon)          |
| Claude Fable 5.2 Anthropic        | Pass 11/11 | 24.1 s      | 36.4 s     | 3,874         | 2,121     | $0.161    | [$0.0966](https://straitly.ai/models/claude-fable-5.2)         |
| DeepSeek V4.1 Flash 1017 DeepSeek | Pass 11/11 | 3.9 s       | 194 s      | 28.7K         | 27.8K     | $0.0346   | [$0.0104](https://straitly.ai/models/deepseek-v4-1-flash-1017) |
| Kimi K3.1 Pro Moonshot            | Pass 11/11 | 2.3 s       | 206 s      | 6,712         | 6,016     | $0.0681   | [$0.0388](https://straitly.ai/models/kimi-k3.1-pro)            |

One run per model, 26 November 2026, 5:50 PM to 5:55 PM PT. Reasoning tokens are part of output tokens. List cost is the run's input and output tokens at the maker's list price. The Straitly price column is the same tokens at the Straitly catalog price that day. Gemini 4 Neon: see its model page.

## What did each model write?

The prompt and all seven replies, exactly as they came back. Open one to read it.

**The prompt Sent word for word to every model**

System: You are a senior software engineer. Follow the requested output format exactly.

Build a React 19 + TypeScript component \`TagInput\` in a single file \`TagInput.tsx\` with a named export \`TagInput\`. Props: - \`value: string\[\]\` (controlled list of tags) - \`onChange: (next: string\[\]) => void\` - \`placeholder?: string\` - \`maxTags?: number\` - \`label: string\` (accessible name of the text input) Behavior: 1\. Renders each tag in \`value\` as a list item (\`<li>\`) inside a \`<ul>\`, in order, showing the tag text and a \`<button type="button">\` with \`aria-label="Remove <tag>"\` that removes that tag. 2\. Renders one text \`<input>\` whose accessible name is \`label\` (use a \`<label>\` element or \`aria-label\`). 3\. Pressing Enter or typing a comma commits the current input text as a tag: trim it; ignore it if empty; ignore it if it equals an existing tag case-insensitively. After a commit attempt (added or ignored), the input is cleared. Enter must not submit a surrounding form. 4\. Pasting text that contains commas or newlines splits it and commits every piece using the same rules (trim, skip empty, skip case-insensitive duplicates, including duplicates inside the pasted text). The pasted text must not end up in the input. 5\. Pressing Backspace while the input is empty removes the last tag. 6\. When \`maxTags\` is set and \`value.length >= maxTags\`, the input is disabled and no more tags can be added. Pieces of a paste beyond the limit are dropped. 7\. When the input loses focus with non-empty text, that text is committed as a tag (same rules). 8\. Every change goes through \`onChange\` with a new array; never mutate \`value\`. No styling library and no other dependencies besides React. Return only the file.

**Claude Opus 5.5 Pass, 11 of 11, 28.5 s, 3,090 output tokens**

```
import { useId, useState } from "react";
import type { ChangeEvent, ClipboardEvent, KeyboardEvent } from "react";

export interface TagInputProps {
  value: string[];
  onChange: (next: string[]) => void;
  placeholder?: string;
  maxTags?: number;
  label: string;
}

const PASTE_SEPARATORS = /[,\r\n]+/;

export function TagInput({
  value,
  onChange,
  placeholder,
  maxTags,
  label,
}: TagInputProps) {
  const [draft, setDraft] = useState("");
  const inputId = useId();

  const atLimit = maxTags !== undefined && value.length >= maxTags;

  /**
   * Commits each candidate piece using the shared rules: trim, skip empty,
   * skip case-insensitive duplicates (against existing tags and earlier
   * pieces), and stop once maxTags is reached. Always clears the draft.
   */
  const commit = (pieces: string[]) => {
    const next = [...value];
    const seen = new Set(value.map((tag) => tag.toLowerCase()));

    for (const raw of pieces) {
      if (maxTags !== undefined && next.length >= maxTags) break;
      const tag = raw.trim();
      if (tag === "") continue;
      const key = tag.toLowerCase();
      if (seen.has(key)) continue;
      seen.add(key);
      next.push(tag);
    }

    if (next.length !== value.length) {
      onChange(next);
    }
    setDraft("");
  };

  const removeAt = (index: number) => {
    onChange(value.filter((_, i) => i !== index));
  };

  const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
    if (event.nativeEvent.isComposing) return;

    if (event.key === "Enter") {
      // Never let Enter submit a surrounding form.
      event.preventDefault();
      commit([draft]);
      return;
    }

    if (event.key === ",") {
      event.preventDefault();
      commit([draft]);
      return;
    }

    if (event.key === "Backspace" && draft === "" && value.length > 0) {
      event.preventDefault();
      removeAt(value.length - 1);
    }
  };

  const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
    const text = event.target.value;
    // Fallback for commas that arrive without a keydown (IME, autofill, etc.).
    if (text.includes(",")) {
      commit(text.split(","));
      return;
    }
    setDraft(text);
  };

  const handlePaste = (event: ClipboardEvent<HTMLInputElement>) => {
    const pasted = event.clipboardData.getData("text");
    if (!PASTE_SEPARATORS.test(pasted)) return; // let a plain paste happen normally

    event.preventDefault();
    const input = event.currentTarget;
    const start = input.selectionStart ?? draft.length;
    const end = input.selectionEnd ?? draft.length;
    const combined = draft.slice(0, start) + pasted + draft.slice(end);
    commit(combined.split(PASTE_SEPARATORS));
  };

  const handleBlur = () => {
    if (draft !== "") {
      commit([draft]);
    }
  };

  return (
    <div>
      <ul>
        {value.map((tag, index) => (
          <li key={`${index}-${tag}`}>
            <span>{tag}</span>
            <button
              type="button"
              aria-label={`Remove ${tag}`}
              onClick={() => removeAt(index)}
            >
              ×
            </button>
          </li>
        ))}
      </ul>
      <label htmlFor={inputId}>{label}</label>
      <input
        id={inputId}
        type="text"
        value={draft}
        placeholder={placeholder}
        disabled={atLimit}
        onChange={handleChange}
        onKeyDown={handleKeyDown}
        onPaste={handlePaste}
        onBlur={handleBlur}
      />
    </div>
  );
}
```

**GPT-6.2 Astra Pass, 11 of 11, 3.5 s, 589 output tokens**

import { useState } from "react"; type TagInputProps = { value: string\[\]; onChange: (next: string\[\]) => void; placeholder?: string; maxTags?: number; label: string; }; export function TagInput({ value, onChange, placeholder, maxTags, label, }: TagInputProps) { const \[draft, setDraft\] = useState(""); const disabled = maxTags !== undefined && value.length >= maxTags; function commit(pieces: string\[\]) { setDraft(""); const next = \[...value\]; const seen = new Set(value.map((tag) => tag.toLowerCase())); for (const piece of pieces) { if (maxTags !== undefined && next.length >= maxTags) break; const tag = piece.trim(); const key = tag.toLowerCase(); if (!tag || seen.has(key)) continue; next.push(tag); seen.add(key); } if (next.length !== value.length) onChange(next); } function remove(index: number) { onChange(value.filter((\_, i) => i !== index)); } return ( <div> <ul> {value.map((tag, index) => ( <li key={\`${index}:${tag}\`}> {tag}{" "} <button type="button" aria-label={\`Remove ${tag}\`} onClick={() => remove(index)} > Remove </button> </li> ))} </ul> <input type="text" aria-label={label} placeholder={placeholder} disabled={disabled} value={draft} onChange={(event) => { const text = event.currentTarget.value; if (text.includes(",")) commit(text.split(",")); else setDraft(text); }} onKeyDown={(event) => { if (event.nativeEvent.isComposing) return; if (event.key === "Enter" || event.key === ",") { event.preventDefault(); commit(\[event.currentTarget.value\]); } else if ( event.key === "Backspace" && event.currentTarget.value === "" && value.length > 0 ) { event.preventDefault(); remove(value.length - 1); } }} onPaste={(event) => { const text = event.clipboardData.getData("text/plain"); if (/\[,\\r\\n\]/.test(text)) { event.preventDefault(); commit(text.split(/\[,\\r\\n\]+/)); } }} onBlur={(event) => { if (event.currentTarget.value !== "") { commit(\[event.currentTarget.value\]); } }} /> </div> ); }

**Gemini 4 Neon Pass, 11 of 11, 111 s, 860 output tokens**

```
import React, { useId, useState } from 'react';

export interface TagInputProps {
  value: string[];
  onChange: (next: string[]) => void;
  placeholder?: string;
  maxTags?: number;
  label: string;
}

export function TagInput({
  value,
  onChange,
  placeholder,
  maxTags,
  label,
}: TagInputProps) {
  const [draft, setDraft] = useState('');
  const inputId = useId();

  const isAtMax = maxTags !== undefined && value.length >= maxTags;

  const appendCandidates = (candidates: string[]) => {
    if (isAtMax) {
      return;
    }

    const seen = new Set(value.map((tag) => tag.toLowerCase()));
    const additions: string[] = [];
    const remainingCapacity =
      maxTags !== undefined ? Math.max(0, maxTags - value.length) : Infinity;

    for (const raw of candidates) {
      if (additions.length >= remainingCapacity) {
        break;
      }
      const trimmed = raw.trim();
      if (!trimmed) {
        continue;
      }
      const normalized = trimmed.toLowerCase();
      if (seen.has(normalized)) {
        continue;
      }
      seen.add(normalized);
      additions.push(trimmed);
    }

    if (additions.length > 0) {
      onChange([...value, ...additions]);
    }
  };

  const commitSingle = (rawText: string) => {
    appendCandidates([rawText]);
    setDraft('');
  };

  const handleRemove = (indexToRemove: number) => {
    onChange(value.filter((_, idx) => idx !== indexToRemove));
  };

  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    const nextText = event.target.value;

    if (nextText.includes(',')) {
      const parts = nextText.split(',');
      const completeParts = parts.slice(0, -1);
      const trailing = parts[parts.length - 1] ?? '';

      appendCandidates(completeParts);
      setDraft(trailing);
      return;
    }

    setDraft(nextText);
  };

  const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
    if (event.key === 'Enter') {
      event.preventDefault();
      commitSingle(draft);
      return;
    }

    if (event.key === 'Backspace' && draft === '' && value.length > 0) {
      event.preventDefault();
      onChange(value.slice(0, -1));
    }
  };

  const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {
    const pastedText = event.clipboardData.getData('text');
    if (!pastedText.includes(',') && !pastedText.includes('\n') && !pastedText.includes('\r')) {
      return;
    }

    event.preventDefault();
    const pieces = pastedText.split(/[,\r\n]+/);
    appendCandidates(pieces);
    setDraft('');
  };

  const handleBlur = () => {
    if (draft.trim() !== '') {
      commitSingle(draft);
    } else if (draft !== '') {
      setDraft('');
    }
  };

  return (
    <div>
      <ul role="list">
        {value.map((tag, index) => (
          <li key={`${index}-${tag}`}>
            <span>{tag}</span>
            <button
              type="button"
              aria-label={`Remove ${tag}`}
              onClick={() => handleRemove(index)}
            >
              ×
            </button>
          </li>
        ))}
      </ul>

      <label htmlFor={inputId}>{label}</label>
      <input
        id={inputId}
        type="text"
        value={draft}
        placeholder={placeholder}
        disabled={isAtMax}
        onChange={handleChange}
        onKeyDown={handleKeyDown}
        onPaste={handlePaste}
        onBlur={handleBlur}
      />
    </div>
  );
}
```

**Gemini 4 Carbon Pass, 11 of 11, 15.4 s, 934 output tokens**

```
import React, { useId, useState } from 'react';

export interface TagInputProps {
  value: string[];
  onChange: (next: string[]) => void;
  placeholder?: string;
  maxTags?: number;
  label: string;
}

export function TagInput({
  value,
  onChange,
  placeholder,
  maxTags,
  label,
}: TagInputProps) {
  const [inputValue, setInputValue] = useState('');
  const inputId = useId();

  const isDisabled = maxTags !== undefined && value.length >= maxTags;

  const commitTags = (candidates: string[]) => {
    if (isDisabled) {
      return;
    }

    const existingLower = new Set(value.map((t) => t.toLowerCase()));
    const added: string[] = [];

    for (const raw of candidates) {
      if (maxTags !== undefined && value.length + added.length >= maxTags) {
        break;
      }
      const trimmed = raw.trim();
      if (!trimmed) {
        continue;
      }
      const lower = trimmed.toLowerCase();
      if (existingLower.has(lower)) {
        continue;
      }
      existingLower.add(lower);
      added.push(trimmed);
    }

    if (added.length > 0) {
      onChange([...value, ...added]);
    }
  };

  const removeTagAt = (index: number) => {
    const next = value.filter((_, i) => i !== index);
    onChange(next);
  };

  const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
    if (e.key === 'Enter') {
      e.preventDefault();
      commitTags([inputValue]);
      setInputValue('');
    } else if (e.key === ',') {
      e.preventDefault();
      commitTags([inputValue]);
      setInputValue('');
    } else if (e.key === 'Backspace' && inputValue === '') {
      if (value.length > 0) {
        removeTagAt(value.length - 1);
      }
    }
  };

  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    const nextVal = e.target.value;
    if (nextVal.includes(',')) {
      const parts = nextVal.split(',');
      commitTags(parts);
      setInputValue('');
    } else {
      setInputValue(nextVal);
    }
  };

  const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
    const pasted = e.clipboardData.getData('text');
    if (/[,|\r|\n]/.test(pasted)) {
      e.preventDefault();
      const pieces = pasted.split(/,|\r\n|\r|\n/);
      commitTags(pieces);
    }
  };

  const handleBlur = () => {
    if (inputValue.length > 0) {
      commitTags([inputValue]);
      setInputValue('');
    }
  };

  return (
    <div>
      <label htmlFor={inputId}>{label}</label>
      <ul>
        {value.map((tag, index) => (
          <li key={`${tag}-${index}`}>
            <span>{tag}</span>
            <button
              type="button"
              aria-label={`Remove ${tag}`}
              onClick={() => removeTagAt(index)}
            >
              &times;
            </button>
          </li>
        ))}
      </ul>
      <input
        id={inputId}
        type="text"
        value={inputValue}
        placeholder={placeholder}
        disabled={isDisabled}
        onChange={handleChange}
        onKeyDown={handleKeyDown}
        onPaste={handlePaste}
        onBlur={handleBlur}
      />
    </div>
  );
}
```

**Claude Fable 5.2 Pass, 11 of 11, 36.4 s, 3,874 output tokens**

```
import {
  useId,
  useRef,
  useState,
  type ChangeEvent,
  type ClipboardEvent,
  type KeyboardEvent,
} from "react";

export interface TagInputProps {
  /** Controlled list of tags. */
  value: string[];
  /** Called with a new array whenever the list of tags changes. */
  onChange: (next: string[]) => void;
  placeholder?: string;
  /** Maximum number of tags allowed. */
  maxTags?: number;
  /** Accessible name of the text input. */
  label: string;
}

const SEPARATOR_TEST = /[,\r\n]/;
const SEPARATOR_SPLIT = /[,\r\n]+/;

export function TagInput({
  value,
  onChange,
  placeholder,
  maxTags,
  label,
}: TagInputProps) {
  const [draft, setDraft] = useState("");
  const inputId = useId();
  const inputRef = useRef<HTMLInputElement>(null);

  const isFull = maxTags !== undefined && value.length >= maxTags;

  /**
   * Commits one or more candidate tags in a single `onChange` call.
   * Trims each piece, skips empties, skips case-insensitive duplicates
   * (against existing tags and earlier pieces), and drops anything
   * beyond `maxTags`. Never mutates `value`.
   */
  const commitPieces = (pieces: readonly string[]): void => {
    const next = [...value];
    const seen = new Set(value.map((tag) => tag.toLowerCase()));

    for (const piece of pieces) {
      if (maxTags !== undefined && next.length >= maxTags) break;

      const tag = piece.trim();
      if (tag === "") continue;

      const key = tag.toLowerCase();
      if (seen.has(key)) continue;

      seen.add(key);
      next.push(tag);
    }

    if (next.length !== value.length) {
      onChange(next);
    }
  };

  const handleChange = (event: ChangeEvent<HTMLInputElement>): void => {
    const text = event.target.value;

    // A typed comma (or any separator that slipped in) commits the text.
    if (SEPARATOR_TEST.test(text)) {
      commitPieces(text.split(SEPARATOR_SPLIT));
      setDraft("");
      return;
    }

    setDraft(text);
  };

  const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>): void => {
    // Don't interfere with IME composition (Enter confirms the composition).
    if (event.nativeEvent.isComposing) return;

    if (event.key === "Enter") {
      // Never submit a surrounding form.
      event.preventDefault();
      commitPieces([event.currentTarget.value]);
      setDraft("");
      return;
    }

    if (
      event.key === "Backspace" &&
      !event.repeat &&
      event.currentTarget.value === "" &&
      value.length > 0
    ) {
      event.preventDefault();
      onChange(value.slice(0, -1));
    }
  };

  const handlePaste = (event: ClipboardEvent<HTMLInputElement>): void => {
    const pasted = event.clipboardData.getData("text");

    // Plain pastes without separators behave like normal typing.
    if (!SEPARATOR_TEST.test(pasted)) return;

    event.preventDefault();

    // Merge the pasted text into the current text at the caret/selection,
    // exactly as the browser would have, then split and commit everything.
    const input = event.currentTarget;
    const current = input.value;
    const start = input.selectionStart ?? current.length;
    const end = input.selectionEnd ?? start;
    const combined = current.slice(0, start) + pasted + current.slice(end);

    commitPieces(combined.split(SEPARATOR_SPLIT));
    setDraft("");
  };

  const handleBlur = (): void => {
    if (draft === "") return;
    commitPieces([draft]);
    setDraft("");
  };

  const removeAt = (index: number): void => {
    onChange(value.filter((_, i) => i !== index));
    // Keep keyboard focus in the widget once the button unmounts.
    inputRef.current?.focus();
  };

  return (
    <div>
      <label htmlFor={inputId}>{label}</label>
      <ul>
        {value.map((tag, index) => (
          <li key={`${index}:${tag}`}>
            <span>{tag}</span>
            <button
              type="button"
              aria-label={`Remove ${tag}`}
              onClick={() => removeAt(index)}
            >
              ×
            </button>
          </li>
        ))}
      </ul>
      <input
        ref={inputRef}
        id={inputId}
        type="text"
        value={draft}
        placeholder={placeholder}
        disabled={isFull}
        autoComplete="off"
        onChange={handleChange}
        onKeyDown={handleKeyDown}
        onPaste={handlePaste}
        onBlur={handleBlur}
      />
    </div>
  );
}
```

**DeepSeek V4.1 Flash 1017 Pass, 11 of 11, 194 s, 28.7K output tokens**

```
import * as React from 'react';

type TagInputProps = {
  value: string[];
  onChange: (next: string[]) => void;
  placeholder?: string;
  maxTags?: number;
  label: string;
};

const SEPARATOR_RE = /[,\r\n]/;
const SEPARATOR_SPLIT_RE = /[,\r\n]+/;

export function TagInput({
  value,
  onChange,
  placeholder,
  maxTags,
  label,
}: TagInputProps) {
  const inputId = React.useId();
  const [inputValue, setInputValue] = React.useState('');
  const atMaxTags = maxTags !== undefined && value.length >= maxTags;

  const commitTags = (rawTags: readonly string[]) => {
    const limit = maxTags === undefined ? Number.POSITIVE_INFINITY : maxTags;

    if (value.length >= limit) {
      return;
    }

    const next = [...value];
    const seen = new Set(next.map((tag) => tag.toLowerCase()));

    for (const rawTag of rawTags) {
      if (next.length >= limit) {
        break;
      }

      const tag = rawTag.trim();
      if (!tag) {
        continue;
      }

      const key = tag.toLowerCase();
      if (seen.has(key)) {
        continue;
      }

      seen.add(key);
      next.push(tag);
    }

    if (next.length !== value.length) {
      onChange(next);
    }
  };

  const commitInput = (text: string) => {
    commitTags([text]);
    setInputValue('');
  };

  const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
    if (event.key === 'Enter') {
      event.preventDefault();
      if (!event.nativeEvent.isComposing) {
        commitInput(event.currentTarget.value);
      }
      return;
    }

    if (event.nativeEvent.isComposing) {
      return;
    }

    if (event.key === ',') {
      event.preventDefault();
      commitInput(event.currentTarget.value);
      return;
    }

    if (
      event.key === 'Backspace' &&
      event.currentTarget.value === '' &&
      value.length > 0
    ) {
      event.preventDefault();
      onChange(value.slice(0, -1));
    }
  };

  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    const nextValue = event.target.value;

    if (SEPARATOR_RE.test(nextValue)) {
      commitTags(nextValue.split(SEPARATOR_SPLIT_RE));
      setInputValue('');
      return;
    }

    setInputValue(nextValue);
  };

  const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {
    const pastedText = event.clipboardData?.getData('text') ?? '';

    if (!SEPARATOR_RE.test(pastedText)) {
      return;
    }

    event.preventDefault();
    commitTags(pastedText.split(SEPARATOR_SPLIT_RE));
  };

  const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {
    const text = event.currentTarget.value;

    if (text !== '') {
      commitTags([text]);
      setInputValue('');
    }
  };

  const handleRemove = (index: number) => {
    onChange(value.filter((_, itemIndex) => itemIndex !== index));
  };

  return (
    <div>
      <ul>
        {value.map((tag, index) => (
          <li key={`${tag}-${index}`}>
            {tag}
            <button
              type="button"
              aria-label={`Remove ${tag}`}
              onClick={() => handleRemove(index)}
            >
              ×
            </button>
          </li>
        ))}
      </ul>

      <label htmlFor={inputId}>{label}</label>
      <input
        id={inputId}
        type="text"
        value={inputValue}
        placeholder={placeholder}
        disabled={atMaxTags}
        autoComplete="off"
        onChange={handleChange}
        onKeyDown={handleKeyDown}
        onPaste={handlePaste}
        onBlur={handleBlur}
      />
    </div>
  );
}
```

**Kimi K3.1 Pro Pass, 11 of 11, 206 s, 6,712 output tokens**

import { useState, type ChangeEvent, type ClipboardEvent, type KeyboardEvent, } from "react"; type TagInputProps = { value: string\[\]; onChange: (next: string\[\]) => void; placeholder?: string; maxTags?: number; label: string; }; export function TagInput({ value, onChange, placeholder, maxTags, label, }: TagInputProps) { const \[inputValue, setInputValue\] = useState(""); const isAtLimit = maxTags !== undefined && value.length >= maxTags; const commit = (pieces: string\[\]) => { const next = \[...value\]; const existing = new Set(value.map((tag) => tag.toLowerCase())); for (const piece of pieces) { if (maxTags !== undefined && next.length >= maxTags) { break; } const tag = piece.trim(); if (!tag) { continue; } const normalized = tag.toLowerCase(); if (existing.has(normalized)) { continue; } existing.add(normalized); next.push(tag); } setInputValue(""); if (next.length !== value.length) { onChange(next); } }; const handleChange = (event: ChangeEvent<HTMLInputElement>) => { const text = event.target.value; if (text.includes(",")) { commit(text.split(",")); return; } setInputValue(text); }; const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => { if (event.key === "Enter") { event.preventDefault(); commit(\[inputValue\]); return; } if ( event.key === "Backspace" && inputValue === "" && value.length > 0 ) { event.preventDefault(); onChange(value.slice(0, -1)); } }; const handlePaste = (event: ClipboardEvent<HTMLInputElement>) => { const text = event.clipboardData.getData("text"); if (!/\[,\\r\\n\]/.test(text)) { return; } event.preventDefault(); commit(text.split(/\[,\\r\\n\]/)); }; const removeTag = (index: number) => { onChange(value.filter((\_, tagIndex) => tagIndex !== index)); }; return ( <div> <ul> {value.map((tag, index) => ( <li key={\`${tag}-${index}\`}> <span>{tag}</span> <button type="button" aria-label={\`Remove ${tag}\`} onClick={() => removeTag(index)} > × </button> </li> ))} </ul> <input type="text" aria-label={label} value={inputValue} placeholder={placeholder} disabled={isAtLimit} onChange={handleChange} onKeyDown={handleKeyDown} onPaste={handlePaste} onBlur={() => { if (inputValue !== "") { commit(\[inputValue\]); } }} /> </div> ); }

## How was this run?

One run per model on the same day, through one API, graded by the same tests.

- **Run** 26 November 2026, 5:50 PM to 5:55 PM PT. Each model got each task once, with the same system prompt and the same user prompt, word for word.
- **How it was called** Through the Straitly API (OpenAI chat completions format, streaming) with our own test key. Each model's default temperature, max\_tokens 32,000, no tools.
- **Grading** The code block in the reply was saved and run against 11 Vitest and Testing Library tests, plus a strict tsc check. Pass means every check passed.
- **Time** First token is the time from sending the request to the first streamed token, reasoning tokens included. Total time runs to the last token. Both were timed on the calling machine, so network time is included.
- **Tokens** From the usage block each reply ended with. Reasoning tokens are part of output tokens and are billed as output. The reasoning figure is what that block reported: Gemini 4 Neon reported none on all three tasks, though its first token took over a minute each time.
- **List cost** Input and output tokens times the maker's list price per 1M tokens, read on the run day. DeepSeek ran in its peak hours. Gemini 4 Carbon's rate is the one in force until 30 November 2026.
- **Straitly price** The same tokens at the Straitly catalog price on the run day. Gemini 4 Neon shows a link to its model page instead.
- **Reruns** One. Claude Fable 5.2's first request on the failing-test task timed out while connecting, before any token came back. It was sent again, and the second run is the one shown. Nothing was rerun for a better answer.

### Rates used

| Model                             | List           | Straitly price                                                       |
| --------------------------------- | -------------- | -------------------------------------------------------------------- |
| Claude Opus 5.5 Anthropic         | $4.00 / $20.00 | [$2.40 / $12.00](https://straitly.ai/models/claude-opus-5-5)         |
| GPT-6.2 Astra OpenAI              | $8.00 / $40.00 | [$4.80 / $24.00](https://straitly.ai/models/gpt-6.2-astra)           |
| Gemini 4 Neon Google              | $3.00 / $15.00 | [See model page](https://straitly.ai/models/gemini-4-neon)           |
| Gemini 4 Carbon Google            | $2.00 / $10.00 | [$2.00 / $10.00](https://straitly.ai/models/gemini-4-carbon)         |
| Claude Fable 5.2 Anthropic        | $8.00 / $40.00 | [$4.80 / $24.00](https://straitly.ai/models/claude-fable-5.2)        |
| DeepSeek V4.1 Flash 1017 DeepSeek | $0.30 / $1.20  | [$0.09 / $0.36](https://straitly.ai/models/deepseek-v4-1-flash-1017) |
| Kimi K3.1 Pro Moonshot            | $2.00 / $10.00 | [$1.14 / $5.70](https://straitly.ai/models/kimi-k3.1-pro)            |

List prices from each maker's pricing page, read on the run day. DeepSeek ran in its peak hours, so its peak rate applies.

## What else do people ask?

[Ask a question](https://straitly.ai/contact)

- ### Which AI model is best at this task?
On this run all 7 models passed all 11 checks, so pick on speed and cost: GPT-6.2 Astra was fastest at 3.5 s and Gemini 4 Carbon cost the least at list price, $0.0103.
- ### How was each answer graded?
By running it: 11 Vitest and Testing Library tests, plus a strict tsc check. A model passes only with every check green. Nobody scored the answers by reading them.
- ### Is one run enough to rank models?
No. Each model ran once, on 26 November 2026, so a gap of a few seconds can flip on another run. Gaps of a minute or more showed up on all three tasks.
- ### What does time to first token mean here?
Seconds from sending the request to the first streamed token, reasoning tokens included. Total time runs to the last token.

## Sources

List prices quoted from each maker's own pricing page on the run day. Spot something out of date? Tell us at [straitly.ai/contact](https://straitly.ai/contact).

1. \[1\] [Anthropic pricing](https://platform.claude.com/docs/en/about-claude/pricing) platform.claude.com, checked 26 November 2026
2. \[2\] [OpenAI pricing](https://developers.openai.com/api/docs/pricing) developers.openai.com, checked 26 November 2026
3. \[3\] [Gemini API pricing](https://ai.google.dev/gemini-api/docs/pricing) ai.google.dev, checked 26 November 2026
4. \[4\] [DeepSeek pricing](https://api-docs.deepseek.com/quick%5Fstart/pricing) api-docs.deepseek.com, checked 26 November 2026
5. \[5\] [Kimi API pricing](https://platform.kimi.ai/docs/pricing/chat) platform.kimi.ai, checked 26 November 2026
6. \[6\] [Straitly model catalog](https://straitly.ai/models) straitly.ai/models, checked 26 November 2026

**What each source says**

Anthropic pricing

Claude Opus 5.5 $4 / $20 and Claude Fable 5.2 $8 / $40 per 1M input / output tokens, base rate.

OpenAI pricing

gpt-6.2-astra $8 / $40 per 1M input / output tokens, Standard, prompts up to 272K tokens.

Gemini API pricing

Gemini 4 Neon $3 / $15 per 1M input / output tokens, paid tier. Gemini 4 Carbon $2 / $10 through 30 November 2026 and $4 / $20 from 1 December 2026.

DeepSeek pricing

V4.1 Flash $0.30 / $1.20 per 1M input (cache miss) / output tokens in peak hours, 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays; half that off-peak.

Kimi API pricing

kimi-k3.1-pro $2 / $10 per 1M input (cache miss) / output tokens.

Straitly model catalog

The per-model price list /models prints, read on the run day.

Read next: [Fix a failing test](https://straitly.ai/shootouts/fix-failing-test) , [Write a SQL migration](https://straitly.ai/shootouts/sql-migration) , [All shootouts](https://straitly.ai/shootouts) , [All comparisons](https://straitly.ai/compare).

## Start with one request.

Run the same prompt on every model with one key. [See pricing](https://straitly.ai/pricing).

[Console](https://straitly.ai/app) [Talk to sales ](https://straitly.ai/contact)

---
Markdown version of https://straitly.ai/shootouts/react-component.
