/openai-to-nova-migration:openai-to-novafrom openai-to-nova-migration
Migrates OpenAI GPT-4o/4.1/5.x Python code and prompts to Amazon Nova 2 Lite. Converts openai SDK calls to boto3 Bedrock Runtime converse API and rewrites prompts for Nova format.
Ships in openai-to-nova-migration. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Migrate Python application code and prompts from OpenAI (GPT-4o, GPT-4.1, GPT-5.x) to Amazon Nova 2 Lite. Transforms SDK calls (openai → boto3 Bedrock Runtime converse API) and rewrites prompts to follow Nova 2 Lite formatting and constraints.
Two source situations are supported:
api.openai.com) — the customer calls GPT models through the openai SDK. Auth, SDK, request structure, and error handling all change.references/openai-on-bedrock-patterns.md.This is not a one-line model swap (except the trivial gpt-oss-on-Converse case). Every migration delivers two things: working migrated code and an explanation of every change, including any features that cannot be ported 1:1.
Use this skill when:
api.openai.com) to call Nova 2 Lite via Bedrockresponse_format) to Nova's approachopenai → boto3 Bedrock Runtime converse APIOPENAI_API_KEY) → AWS IAM credentials (role, profile, env vars)role: "system" message → dedicated system=[{"text": ...}] parameter[{"text": "..."}])max_tokens, temperature, top_p → nested in inferenceConfig with camelCase (maxTokens, topP)##Section Name## delimitersresponse_format (JSON schema) → tool-forcing or inline schemareasoning_effort (GPT-5.x) → additionalModelRequestFields.reasoningConfignova_code_interpreter built-in toolgpt-image) → Use Amazon Nova Canvas (separate model)You MUST follow these steps in order. After each step, confirm findings with the user before proceeding to the next.
First, identify WHERE the model runs — this determines how much changes:
api.openai.com) — plain OpenAI(api_key=...) with no Bedrock base URL. Auth, SDK, and request structure all change. Continue with this workflow.openai client pointed at a bedrock-mantle base URL, the BedrockOpenAI client, or boto3 converse/invoke_model with an openai.* model ID. Auth/Region are already AWS-native. You MUST read references/openai-on-bedrock-patterns.md — it identifies the two model classes (GPT-5.5/5.4 Responses-only vs gpt-oss multi-API) and their migration paths, then routes back here for the shared steps (prompt formatting, reasoning, tools).Then identify the SDK and API style:
client.chat.completions.create(...) (most common)client.responses.create(...) (newer; input= + instructions=, or developer/user roles on Bedrock)client.beta.assistants.create(...) / client.beta.threads.* (stateful, built-in tools)Then identify which features are used:
response_format, JSON mode)reasoning_effort)You MUST flag any features in the "cannot migrate" list above and inform the user of alternatives before proceeding.
If the source model is a high-capability reasoning model (gpt-5.5, gpt-5.4, gpt-5.2, o3, o1) run at high reasoning effort, you MUST ask the user whether they have evaluated Nova 2 Lite for their use case. Start every migration with Nova 2 Lite; Nova 2 Pro exists for workloads where Lite with high-effort reasoning still falls short, but the user should validate that need with benchmark data before targeting Pro.
Reasoning support by OpenAI model:
| OpenAI Model | Native Reasoning Effort |
|---|---|
gpt-4o / gpt-4o-mini | No — if CoT is used, it's via prompt text ("think step by step") |
gpt-4.1 / gpt-4.1-mini | No |
gpt-4 / gpt-3.5-turbo | No |
gpt-5 / gpt-5.2 | Yes — reasoning_effort parameter |
o1 / o3 | Yes — reasoning models |
Migration rules for reasoning:
additionalModelRequestFields entirely. If the prompt uses CoT ("think step by step"), keep that prompt text as-is.additionalModelRequestFields entirely.| Nova Effort | Config |
|---|---|
low | additionalModelRequestFields={"reasoningConfig": {"type": "enabled", "maxReasoningEffort": "low"}} |
medium | additionalModelRequestFields={"reasoningConfig": {"type": "enabled", "maxReasoningEffort": "medium"}} |
high | additionalModelRequestFields={"reasoningConfig": {"type": "enabled", "maxReasoningEffort": "high"}} — MUST omit inferenceConfig (temperature, topP, maxTokens, topK not allowed) and set client read_timeout=3600 |
Do NOT map OpenAI's effort level directly to Nova's by name. OpenAI
minimal/low/medium/highand Novalow/medium/highare not numerically equivalent. Default to Novalowfirst, then increase only if evaluation shows quality gaps. Present the three options and let the user decide.
Determine the Nova 2 Lite use case type for correct inference config:
Text/Agentic:
| Use Case | Temperature | Top P | Reasoning |
|---|---|---|---|
general | 0.7 | default | DISABLED |
tool_calling | 0.7 | 0.9 | DISABLED |
tool_calling_reasoning | 1 | 0.9 | ENABLED |
complex_reasoning | 0.7 | default | ENABLED |
Multimodal:
| Use Case | Temperature | Reasoning |
|---|---|---|
| OCR | 0.7 | DISABLED |
| Key information extraction | 0 | OPTIONAL |
| Object/UI detection | 0 | DISABLED |
| Video summary/caption | 0 | OPTIONAL |
| Video timestamps/classification | 0 | DISABLED |
Precedence rule (high effort overrides the temperature/topP columns). The temperature and Top P values above apply only when reasoning is disabled or set to
low/medium. WhenmaxReasoningEffortishigh, you MUST NOT settemperature,topP,topK, ormaxTokens— omitinferenceConfigentirely, or the request returns a validation error. So atool_calling_reasoningworkload at high effort drops thetemperature=1, topP=0.9values; at low/medium effort it keeps them. (Per the Amazon Nova 2 User Guide: "Temperature, topP and topK cannot be used with maxReasoningEffort set to high.") Note also that high effort can produce more than 65K output tokens (observed up to 128K) — size your downstream handling accordingly.
You MUST read references/feature-mapping.md for the complete field mapping table.
You SHOULD read references/code-examples.md for before/after patterns.
If the source code uses the Responses API (client.responses.create) or the Assistants API (client.beta.assistants.*), you MUST also read references/chat-completions-patterns.md for the specific parameter mappings, Responses API migration, and Assistants-to-built-in-tools handling.
If the source runs on OpenAI hosted on Amazon Bedrock (identified in Step 1), you MUST read references/openai-on-bedrock-patterns.md instead of / in addition to the above — the source SDK, endpoint, and modelId differ, and the gpt-oss-on-Converse case is nearly a one-line modelId swap.
Ask the user which region-prefixed model ID to use:
| Model ID | Region |
|---|---|
us.amazon.nova-2-lite-v1:0 | US (us-east-1, us-west-2) |
eu.amazon.nova-2-lite-v1:0 | EU (eu-west-1, etc.) |
jp.amazon.nova-2-lite-v1:0 | Japan (ap-northeast-1) |
global.amazon.nova-2-lite-v1:0 | Cross-region inference |
Default to us.amazon.nova-2-lite-v1:0 if the user doesn't specify.
SDK transformation (Python):
# OpenAI
from openai import OpenAI
client = OpenAI(api_key="...")
response = client.chat.completions.create(model="gpt-4o-mini", messages=[...])
# Nova 2 Lite
import boto3
client = boto3.client("bedrock-runtime")
response = client.converse(modelId="us.amazon.nova-2-lite-v1:0", messages=[...])
Extract the system prompt from the messages array into a dedicated system parameter:
# OpenAI — system is a message
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello"},
]
# Nova — system is a separate parameter; content is a typed block
system = [{"text": "You are a helpful assistant."}]
messages = [{"role": "user", "content": [{"text": "Hello"}]}]
Only include additionalModelRequestFields when reasoning is enabled:
# Reasoning DISABLED (default) — omit additionalModelRequestFields entirely
response = client.converse(modelId="us.amazon.nova-2-lite-v1:0", ...)
# Reasoning ENABLED — include reasoningConfig
response = client.converse(
modelId="us.amazon.nova-2-lite-v1:0",
...,
additionalModelRequestFields={
"reasoningConfig": {"type": "enabled", "maxReasoningEffort": "medium"}
},
)
OpenAI models tolerate loosely phrased instructions. Nova 2 Lite delivers higher quality when the prompt clearly separates task, input, requirements, constraints, and output format. You MUST apply these transformations:
Add explicit structure using ##Section Name## delimiters (the section name is wrapped on both sides by ##, not a markdown header). Convert any markdown headers or inline instructions into canonical Nova sections:
##Task Summary:## — defines the task##Context Information:## — background##Model Instructions:## — behavioral rules##Response style and format requirements:## — output format##Examples## — few-shot examples##Reference## — RAG grounding contentFor multimodal prompts:
Add suppression guardrail where appropriate:
DO NOT mention anything inside ##Model Instructions## or ##Examples## in the response.
For long context (>10K tokens):
BEGIN INPUT DOCUMENTS
DOCUMENT 1 START
{content}
DOCUMENT 1 END
END INPUT DOCUMENTS
BEGIN QUESTION
{query}
END QUESTION
BEGIN INSTRUCTIONS
{instructions}
END INSTRUCTIONS
Example transformation — vague OpenAI prompt
"Summarize this document and highlight key risks"becomes a structured Nova prompt with explicit## Task Summary:and## Response style and format requirements:sections specifying format, columns, tone, and scope. Seereferences/code-examples.md.
If the OpenAI code uses structured output (response_format={"type": "json_object"} or response_format=<Pydantic model> / json_schema), apply this step. Otherwise skip to Step 6.
temperature=0toolSpec.inputSchema and toolChoice={"tool": {"name": ...}}See references/code-examples.md Example 3 for both patterns.
If the OpenAI code uses function calling / tools, apply this step. Otherwise skip to Step 7.
Key differences:
tools=[{"type": "function", "function": {...}}] → Nova toolConfig={"tools": [{"toolSpec": {...}}]}function.parameters (JSON Schema) → Nova toolSpec.inputSchema.json (JSON Schema — structurally compatible, re-wrap)tool_choice (auto/required/none/named) → Nova toolChoice (auto/any/tool)nova_code_interpreter, nova_grounding) — see references/chat-completions-patterns.mdUse the 'tool_name' tool for XTool use + extended thinking is supported. Nova 2 Lite allows
toolConfigtogether with reasoning enabled — the model reasons about which tools to use and how to interpret their results (per the Amazon Nova 2 User Guide: "Extended thinking works seamlessly with tool calling"). When continuing a tool round-trip with reasoning enabled, append the assistant's full content blocks (including anyreasoningContent) back intomessages, then add thetoolResultin a user-role message.
Output format:
## Migrated Code
**Use case:** {type}
**Inference config:** temperature={T}, reasoning={enabled/disabled}
**Breaking changes:** {list any features that couldn't be migrated 1:1}
### Code
{complete migrated code}
### Prompt
**SYSTEM PROMPT:**
{system prompt — persona only for multimodal}
**USER PROMPT:**
{user prompt with ##Section## formatting}
### Implementation Notes
- {inference config rationale}
- {any multimodal ordering requirements}
- {features requiring alternative approach}
You MUST check the migrated code against all criteria below. If any check fails, fix and re-validate before presenting to the user:
OPENAI_API_KEYsystem parameter, not a role: "system" message[{"text": ...}])inferenceConfig with camelCase namesadditionalModelRequestFields is omitted when reasoning is disabled, or contains reasoningConfig when enabledinferenceConfig removed entirely (no temperature/topP/topK/maxTokens) and read_timeout=3600 set on the client##Section## delimiters with explicit structuretoolSpec; tool_choice mapped to toolChoiceRateLimitError → ThrottlingException, etc.)OpenAI(...) client, response_format)| OpenAI | Nova 2 Lite |
|---|---|
openai SDK | boto3 bedrock-runtime |
client.chat.completions.create() / client.responses.create() | client.converse() |
OPENAI_API_KEY | AWS IAM credentials |
model="gpt-4o-mini" | modelId="us.amazon.nova-2-lite-v1:0" |
{"role": "system", "content": "..."} | system=[{"text": "..."}] |
{"content": "text"} | {"content": [{"text": "text"}]} |
max_tokens / temperature / top_p | inferenceConfig.maxTokens / .temperature / .topP |
tools=[{"type": "function", ...}] | toolConfig={"tools": [{"toolSpec": ...}]} |
tool_choice | toolChoice |
response_format (JSON schema) | Tool-forcing or inline prompt schema |
reasoning_effort="high" | additionalModelRequestFields={"reasoningConfig": {"type": "enabled", "maxReasoningEffort": "high"}} |
stream=True | client.converse_stream() |
RateLimitError / APIError | ThrottlingException / ValidationException |
Problem: Keeping {"role": "system", ...} in the messages array — Bedrock does not accept a system role in messages.
Fix: Extract it into the dedicated system=[{"text": ...}] parameter.
Problem: Passing a flat string as message content ({"content": "hello"}) — Bedrock requires typed content blocks.
Fix: Wrap as {"content": [{"text": "hello"}]}.
Problem: Passing max_tokens/temperature/top_p as top-level arguments to converse().
Fix: Nest them in inferenceConfig with camelCase (maxTokens, temperature, topP).
inferenceConfig with high-effort reasoningProblem: Including maxTokens, temperature, topP, or topK when maxReasoningEffort is high — returns a validation error.
Fix: Remove the entire inferenceConfig block at high effort, and set the client read_timeout=3600.
additionalModelRequestFields when reasoning is disabledProblem: Including reasoning config when reasoning is not needed — adds cost and latency with no benefit.
Fix: Omit additionalModelRequestFields entirely when reasoning is disabled.
Problem: Reusing a vague OpenAI prompt verbatim — Nova quality varies across requests.
Fix: Add explicit ##Section## structure: task, input, format requirements, constraints.
Problem: Putting text before images in the content array, or passing image URLs / base64 strings. Fix: Media content blocks MUST come before the text block, and images must be raw binary bytes.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub aws-samples/amazon-ai-samples --plugin openai-to-nova-migrationOther plugins' skills for the same job