Skip to content

docs: update code samples to current Claude and OpenAI models - #5135

Closed
jackbridger wants to merge 7 commits into
mainfrom
docs/update-ai-model-ids
Closed

jackbridger wants to merge 7 commits into
mainfrom
docs/update-ai-model-ids

Conversation

@jackbridger

@jackbridger jackbridger commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Code samples across the docs pointed at models that no longer work or are about to stop working: gpt-3.5-turbo, gpt-4-turbo and claude-sonnet-4-20250514 are already shut down, claude-sonnet-4-5 retires on November 30, 2026, and gpt-4o / gpt-4o-mini shut down in January 2027. Copying those samples today gives errors.

This swaps model IDs in samples and prose to current models:

Old New
claude-sonnet-4-5, claude-sonnet-4-6, claude-sonnet-4-20250514 claude-sonnet-5-5
claude-haiku-4-5 claude-haiku-5-5
claude-opus-4-6 claude-opus-5-5
gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo gpt-6-luna (OpenAI's listed replacement for gpt-4o)

Alongside the swap:

  • Prompt config examples in ai/prompts and ai-chat/backend used temperature: 0.7, which Claude 5.5 and gpt-6-luna don't support (the AI SDK drops it with a warning), so the examples now use maxOutputTokens: 1024 instead.
  • The prompt caching page now says cache reads cost about 5% of base input on Claude Sonnet 5.5 and Opus 5.5 (it said 10%).

Claude 5.5 models also behave differently from 4.5 in ways a plain ID swap doesn't cover, so a few samples changed further: thinking is on by default and omits its text unless you ask for display: "summarized", a conversation can't end on an assistant turn, and thinking blocks are bound to the earlier system prompt, tools and messages. The compaction summarizers now end with a user instruction, the head-start handler and agent share one system prompt, the Nango sample reads text blocks by type, and the native compaction and per-turn tools pages note where editing history or tools can invalidate thinking blocks.

Every changed sample was run against the live APIs with current packages (ai 7, @ai-sdk/anthropic 4, @ai-sdk/openai 4, @anthropic-ai/sdk, openai, @trigger.dev/sdk 4.8.5), with Anthropic's thinking-block check turned on the way new accounts get it. That surfaced samples that were already broken on current versions, now fixed too:

  • The agent pattern pages put { role: "system" } inside messages, which ai 7 rejects; they now pass system.
  • Tool samples on the schemaTask and migration pages and the Slack agent had no step limit, so they stopped after the tool call with no reply; they now set stopWhen.
  • The native compaction example strips reasoning from the messages it keeps after a summary.
  • Errors & retrying fell back to a Llama 2 model on Replicate that no longer exists; it now falls back to Claude Haiku 5.5.
  • A few missing or wrong imports.

A multi-turn chat.agent built from these docs (tools, summarized reasoning, two compactions) also ran end to end in a dev environment without errors.

Left unchanged on purpose: the AI chat changelog (historical entries and a benchmark measured on a specific model), example-project pages that mirror code in other repos, and the DALL·E 3 image example, which needs a code change rather than a model swap and will follow separately.

Sources: OpenAI deprecations, Anthropic model deprecations.

Several samples used models that are shut down (gpt-3.5-turbo,
gpt-4-turbo, claude-sonnet-4-20250514) or retiring soon
(claude-sonnet-4-5, gpt-4o). Swap them for the Claude 5.5 family and
gpt-6-luna, and drop temperature from prompt configs since newer
Claude models reject non-default values.
@changeset-bot

changeset-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 65d993d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

Walkthrough

The documentation updates model identifiers across AI chat examples, AI agent guides, task examples, and integrations. Prompt examples also change selected configuration options. Compaction and tool guidance adds notes about Claude 5.5 reasoning blocks. The Nango example changes its output limit and response handling. Other examples revise telemetry setup, fallback handling, output formats, and stopping conditions.

Merge Risk: Moderate · previous review 7b33d

The model ID updates are low risk. The observability page still says tracing is opt-in per call, but on AI SDK 7 calls are traced by default and spans can contain prompts and responses. The prompt-linking examples also will not work with the AI SDK 7 adapter. Correct these two points in the docs before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "docs: update code samples to current Claude and OpenAI models" matches the main change. The raw summary shows the PR swaps model IDs across the docs (claude-sonnet-4-5 to claude-sonnet-5-5,…
Description check Passed The description follows the template's main parts. It has a Summary section that explains why the change is needed, with a table of model ID swaps and a list of related sample fixes. It cites sources.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "docs: update code samples to current Claude and OpenAI models" matches the main change. The raw summary shows the PR swaps model IDs across the docs (claude-sonnet-4-5 to claude-sonnet-5-5, gpt-4o to gpt-6-luna, and similar). The title is concise and specific, and it follows a conventional prefix.

Full details: Description check

Explanation

The description follows the template's main parts. It has a Summary section that explains why the change is needed, with a table of model ID swaps and a list of related sample fixes. It cites sources. It does not fill in the template's Closes #issue line, the checklist, the Testing section as a template section, the Changelog, or Screenshots. The author does describe testing in prose: samples were run against live APIs, and a multi-turn chat.agent ran in a dev environment. The description is mostly complete, but the template's required headings are missing.

Resolution

Add the template's "Closes #<issue>" line, complete the checklist items, and add the Testing, Changelog, and Screenshots headings. The author can reuse the existing testing prose under Testing. For the Screenshots section, the author can note that no screenshots apply.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

coderabbitai[bot]

This comment was marked as resolved.

Claude 5.5 models think by default, reject a conversation that ends on
an assistant turn, omit thinking text unless asked, and bind thinking
blocks to the earlier system prompt, tools and messages. Give the
compaction summarizers a final user instruction, match the head-start
system prompt, request summarized thinking where reasoning is streamed,
read text blocks by type in the Nango sample, and note where pruning,
compaction or per-turn tools can invalidate thinking blocks.
Live testing on Claude 5.5, gpt-6-luna and ai 7 found samples that
break for new users. Strip reasoning from messages kept after
compaction, pass system prompts through `system` instead of the
messages array on the agent pattern pages, add step limits so tool
samples return text, replace the Llama 2 fallback with Claude Haiku
5.5, and fix missing or wrong imports.
…elemetry setup

The image tool used experimental_toToolResultContent, which no AI SDK
version we support honors, so the model never saw the chart. Use
toModelOutput with a file part, switch generateObject to generateText
with Output.object, and move the AI SDK 7 adapter note above the
observability sample since v7 emits no spans without it.
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@jackbridger
jackbridger deleted the docs/update-ai-model-ids branch November 17, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant