Skip to content

Flagship

ChatGPT vs Claude for Coding: Compared Side by Side

Run claude-opus-5-5 and gpt-5 head-to-head on your own prompt, with your own API keys. Real responses, cost, and latency side by side. Free, no signup.

On a real coding task, both ChatGPT and Claude wrote correct code. The interesting difference our run turned up was scope. ChatGPT answered exactly what we asked. Claude did that too, then added a runnable test block and extra test cases we had not requested. Our pipeline flagged the extra material as going beyond the prompt, which is neither good nor bad on its own, but it is a real difference you would not see from a pass or fail alone.

The run

The whole setup behind the numbers:

  • Prompt: one Python coding task (below), asking for a function, a docstring, edge-case handling, and a brief complexity note.
  • Models: Claude claude-opus-5-5 and ChatGPT gpt-5.
  • Settings: each model’s default, temperature 0.7, no system prompt, no extra context.
  • Keys: our own, calling each provider directly. One real run.

Prompt

Write a Python function merge_intervals(intervals) that takes a list of [start, end] integer pairs, merges all overlapping intervals, and returns the merged list sorted by start. Include a docstring and handle the empty-input and single-interval cases. Then briefly explain the time complexity.

The result, side by side

Claude (claude-opus-5-5)

  • Correct: yes
  • Cost: $0.0270
  • Speed: 11.2 seconds
  • Length: 1,331 tokens
  • Scope: added an unsolicited main block and extra tests

ChatGPT (gpt-5)

  • Correct: yes
  • Cost: $0.0090 (cheaper here)
  • Speed: 9.1 seconds
  • Length: 889 tokens
  • Scope: lean, close to exactly what was asked

Both used the same correct approach. Here is the core of each:

Claude (claude-opus-5-5)
def merge_intervals(intervals):
    """Merge overlapping intervals, sorted by start. Input is not modified."""
    if not intervals:
        return []
    if len(intervals) == 1:
        start, end = intervals[0]
        return [[start, end]]
    sorted_intervals = sorted(intervals, key=lambda iv: iv[0])
    merged = [list(sorted_intervals[0])]
    for start, end in sorted_intervals[1:]:
        last = merged[-1]
        if start <= last[1]:
            last[1] = max(last[1], end)
        else:
            merged.append([start, end])
    return merged

Then a __main__ block running doctests and several print statements, plus a longer “how it works” section, none of which we asked for.

ChatGPT (gpt-5)
def merge_intervals(intervals):
    """Merge overlapping intervals; returns them sorted by start.
    Handles empty input and single-interval cases. Assumes start <= end."""
    if not intervals:
        return []
    if len(intervals) == 1:
        return [intervals[0][:]]
    intervals = sorted(intervals, key=lambda x: (x[0], x[1]))
    merged = [intervals[0][:]]
    for start, end in intervals[1:]:
        last_start, last_end = merged[-1]
        if start <= last_end:
            merged[-1][1] = max(last_end, end)
        else:
            merged.append([start, end])
    return merged

Then a two-line time and space complexity note, and nothing beyond the ask.

Here is where this matters: the free tool shows you the mechanical facts (correct, cost, length, scope). The paid product goes a step further and tells you why a result is what it is.

Insight: Our evaluation pipeline flagged Claude’s extra output as going beyond the prompt. That is a diagnostic finding, not a verdict:

  • If you wanted a self-testing, well-documented drop-in, the extra material is a plus.
  • If you wanted just the function, it is noise to strip out.

“Correct” was true for both. Whether extra scope helps or hurts is a judgment only you can make for your task. Read the code and decide.

These results come from a specific run on 2026-11-02 on one defined task, using real models through a real pipeline. They show how each model performed on that task, not a general ranking of model quality, which depends entirely on your task and data. Run your own to see your numbers.

Run it on your own coding task

The free tool below opens with Claude and ChatGPT ready to go, and the prompt is editable:

  1. Click Launch to open the notebook.
  2. Swap in your own coding task and add your own API keys.
  3. Read both answers side by side with their cost and speed, in about a minute.

Nothing is sent to our servers, and your keys stay on your machine.

Want to go further? At llmprover.pysolvr.com you can score the code against your own checks, compare up to 20 models at once, and see which part of your setup caused a weak answer.

Run as of 2026-11-02. Models and their behavior change often, so run a fresh comparison to see today’s result on your own coding task.

This free tool is a slice of the full product. With a paid plan you also get:

  • compare up to 20 models at once
  • score which answer is best
  • see which part of your setup caused a weak answer
  • save benchmarks and track changes over time
  • let your AI agent run it for you
See plans ->

Free tool, provided as-is, no warranty. Uses your own API key. You are responsible for your usage and costs. Keys never leave your machine and are never sent to pysolvr. Outputs are informational, not advice. pysolvr is not liable for decisions made from these results.