Skip to content

Lesson 32 ยท Evaluation and Testing Prompts

Porting Prompts Between GPT and Claude

Move a prompt between OpenAI and Claude models: separate the task from vendor settings, map API fields, retune with each official guide and run regression tests.

You may switch providers, add a fallback or simply want to compare. A clear prompt written for a GPT model will usually make sense to Claude, and the reverse. "Makes sense" is not "performs equally well". Porting a prompt is a small migration: you keep the intent, adapt the request and check the result with tests.

This lesson assumes you have a test set and know regression testing.

Split the task from the adapter

Divide your work into two parts:

  • The task core: goal, audience, rules, facts, examples and the definition of a good answer. This should survive a move.
  • The adapter: model ID, field names, effort setting, tool format, output schema wrapper and response parsing. This changes.

If your core is tangled with provider details, untangle it first. Keep the core in one versioned file. Some wording in the core may still need tuning, and when it does, record that change as a separate version.

Map the request fields

This table covers the OpenAI Responses API and Claude's Messages API as documented in December 2026.

Idea OpenAI Responses API Claude Messages API
Standing rules developer message or instructions system
Conversation input messages
Output limit max_output_tokens max_tokens (required)
Thinking depth reasoning.effort output_config.effort
Fixed JSON shape text.format output_config.format
Cut off by the limit status is incomplete; read the reason stop_reason is max_tokens
Reading text Output items, or the SDK's output_text Content blocks of type text

The same word does not mean the same behavior. An effort value of medium on one model does not promise the same amount of thinking, quality or cost on another. Treat effort as a setting to tune again.

Write two adapters

The code below builds request bodies only, so it runs without a key or network. The shared core stays identical.

Python One task core, two request bodies

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The output limit covers reasoning or thinking as well as visible text. A limit sized only for the final one-word label can therefore cut off a reply.

Retune with each guide

Read both vendors' current guides for the exact models. Then check these items:

  1. Old fixes. Lines added to correct one model's habit may overcorrect another. Try without them and add back what tests require.
  2. Length and tone. Default styles differ between models and versions. State the length you want.
  3. Document layout. For long inputs, Anthropic advises documents before the question. For caching, stable reusable content should come first and changing input last. Check that your layout serves both quality and cost.
  4. Unsupported settings. Claude's API version 2026-10-21 rejects sampling parameters such as temperature, and current models reject assistant prefill. OpenAI's migration notes for GPT-6.2 also say to remove temperature and top_p.
  5. Tools. Tool definitions, tool choice options and result messages have different shapes and restrictions. For example, Claude Fable 5.2, Opus 5.5 and Sonnet 5.5 reject forced tool choice. Test every tool path.
  6. Schemas. Each vendor supports a subset of JSON Schema with its own rules. A schema that one accepts may be rejected by the other.

Normalize results, then compare

Give your application one result shape. Parsing differences stay inside the adapter. The dictionaries below are hand-written and heavily simplified, not real output.

Python Stand-in: normalize two response shapes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

This sketch handles plain text answers only. Real code must also handle refusals, tool calls, stop sequences, content filtering and errors. A refusal can arrive in a response that otherwise completed: OpenAI marks it with a refusal content part, and Claude reports a refusal stop reason. An incomplete response can also have causes other than the output limit.

The migration checklist

  • Freeze the old prompt and its test scores as a baseline.
  • Change the adapter, run the tests with unchanged prompt text and record failures.
  • Tune the prompt on one group of cases and confirm on held-back cases.
  • Compare quality, serious failures, cost and delay.
  • Roll out gradually and keep a way to switch back.

For a broader product choice, run the same method as a fair comparison: equal tuning effort on each side, and conclusions limited to your tasks and date.

A fallback to a second provider sends your users' data to another company. Confirm that contracts, privacy notices, retention settings and regional rules allow it before you enable automatic failover.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. Which item belongs to the task core instead of the adapter?

    The classification rule is part of the task itself and should survive a change of provider.
  2. 2. Both requests use effort medium. What can you conclude?

    Effort levels are calibrated per model.
  3. 3. What must you check before automatic failover to another provider?

    Failover moves data to another company, so legal and privacy conditions apply.

Summary

  • Keep the task core separate from a small provider adapter.
  • Field names, limits, schemas and tool formats differ; settings with similar names need retuning.
  • Normalize responses and handle truncation, refusals and errors.
  • Prove the port with a baseline, held-back cases and a gradual rollout.

Next: Prompt Injection: How Attacks Work

Your progress is saved in this browser. No account needed.