How to Reuse the Same Prompt Across ChatGPT, Claude, Gemini, and Ollama
Developing a prompt for one provider and then needing it to work across several others is a common situation — for benchmarking models, for multi-provider architectures, or for switching providers as pricing or quality changes. The core instructions are portable; the JSON wrapper isn't.
What changes between providers
Three structural differences matter:
System prompt placement. OpenAI: inside messages array as {"role":"system"}. Anthropic: top-level "system" parameter. Gemini: "system_instruction" object. Ollama: inside messages array like OpenAI, but model support varies.
Role names for AI responses. OpenAI and Anthropic and Ollama: "assistant". Gemini: "model".
Content structure. OpenAI, Anthropic, Ollama: "content": "text". Gemini: "parts": [{"text": "text"}].
The conversation content — the actual instructions, examples, and constraints — requires no changes. Only the container format changes.
Writing prompts that port easily
Portable prompts separate the invariant parts (instructions, examples, constraints) from the structural parts (role names, content wrappers). Write the core of the prompt as clean text first, then wrap it in whichever format the target provider expects.
Avoid relying on provider-specific capabilities in the prompt logic. Tool calling syntax differs significantly between providers. Vision input structure differs. Some prompt patterns that work reliably on GPT-4o — like specific JSON output schemas — may require minor rewording to produce equivalent results on Claude or Gemini.
A practical conversion workflow
- Develop the prompt in your primary provider
- Use a prompt template converter to produce the target format
- Test with 5–10 representative inputs, including edge cases
- Adjust system instructions if output quality differs in ways that matter
The prompt template converter handles all three structural changes — system prompt placement, role renaming, and content wrapping — automatically. What it doesn't handle is model-specific behaviour differences that might require prompt wording adjustments.
When portability matters less
If you're building a single-provider production application, over-engineering for portability adds complexity for no immediate benefit. Portability matters when you're actively benchmarking multiple providers, building a multi-provider architecture, or in an early phase where the provider choice isn't final.