Skip to content

feat(provider/openai): support GPT-5.6 reasoning and prompt caching controls#17028

Merged
gr2m merged 6 commits into
mainfrom
codex/openai-gpt-5.6-controls
Jul 9, 2026
Merged

feat(provider/openai): support GPT-5.6 reasoning and prompt caching controls#17028
gr2m merged 6 commits into
mainfrom
codex/openai-gpt-5.6-controls

Conversation

@gr2m

@gr2m gr2m commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add GPT-5.6 max reasoning effort support for Chat Completions
  • add Responses API reasoningMode and reasoningContext options, including the effective reasoning context in provider metadata
  • support GPT-5.6 implicit and explicit prompt cache options, 30-minute TTL, and explicit cache breakpoints for supported message content
  • report cache-write tokens for Chat Completions and Responses without double-counting uncached input tokens
  • document GPT-5.6 reasoning, prompt caching, cache-write usage, and original image detail behavior
  • add generateText and streamText examples for pro mode, persisted reasoning context, and explicit prompt caching

Follow-up to #17021.

Test plan

  • pnpm test:node in packages/openai — 19 files, 772 tests
  • pnpm test:edge in packages/openai — 19 files, 772 tests
  • pnpm type-check in packages/openai
  • pnpm type-check:full
  • pnpm check
  • node tools/validate-properties-tables.mjs

Live GPT-5.6 examples were not run locally because no OPENAI_API_KEY was configured.

- **reasoningMode** _'standard' | 'pro'_
Controls how much model work GPT-5.6 performs before returning a final answer. `'standard'` is the default. Use `'pro'` for difficult tasks where quality matters more than latency and token usage.

- **reasoningContext** _'auto' | 'current_turn' | 'all_turns'_

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be camelCase and then normalize to snake_case for api request, if that's what the openai api accepts

Comment thread packages/openai/src/chat/convert-openai-chat-usage.ts
@gr2m
gr2m merged commit b2b1bb9 into main Jul 9, 2026
49 checks passed
@gr2m
gr2m deleted the codex/openai-gpt-5.6-controls branch July 9, 2026 21:06
gr2m added a commit that referenced this pull request Jul 9, 2026
…ching controls (#17039)

## Summary

V5-native backport of #17028 to `release-v5.0`.

- add GPT-5.6 `max` reasoning effort support for Chat Completions
- add Responses API `reasoningMode` and `reasoningContext`, including
the effective context in provider metadata
- support GPT-5.6 implicit and explicit prompt caching, 30-minute TTL,
and explicit content breakpoints
- expose cache-write tokens for Chat and Responses
- backport the GPT-5.6 docs and examples to the v5 layout

The GPT-5.6 model prerequisite is already present through #17023.

### V5 adaptations

`LanguageModelV2Usage` has no cache-write or uncached-input bucket. This
backport leaves that core v5 contract unchanged and exposes writes
consistently as `providerMetadata.openai.usage.cacheWriteTokens`; cache
reads remain at `usage.cachedInputTokens`. Consequently, the upstream
no-cache subtraction is not applicable on v5.

V2 also has no provider options on nested tool-output items. A
breakpoint on a v5 tool-result part therefore applies to the whole
result; for multipart results, the provider places the OpenAI API
breakpoint on the final nested output part.

## Test plan

- `pnpm test:node` in `packages/openai` — 15 files, 569 tests
- `pnpm test:edge` in `packages/openai` — 15 files, 569 tests
- targeted OpenAI suites — 4 files, 385 tests
- targeted Azure provider suite — 1 file, 48 tests
- `pnpm type-check` in `packages/openai`
- `pnpm type-check:full`
- `pnpm build` in `packages/openai`
- `pnpm check`

The release branch does not contain
`tools/validate-properties-tables.mjs`; this change does not modify a
PropertiesTable. Live GPT-5.6 examples were not run because no
`OPENAI_API_KEY` was configured.

## Checklist

- [x] All commits are signed
- [x] Tests have been added / updated
- [x] Documentation has been added / updated
- [x] A patch changeset has been added
- [x] I have reviewed this pull request
gr2m added a commit that referenced this pull request Jul 9, 2026
…ching controls (#17038)

## Summary

Backport of #17028 to `release-v6.0`.

- add GPT-5.6 `max` reasoning effort support for Chat Completions
- add Responses API `reasoningMode` and `reasoningContext`, including
the effective context in provider metadata
- support GPT-5.6 implicit and explicit prompt caching, 30-minute TTL,
and explicit content breakpoints
- report cache-write tokens without double-counting uncached input
tokens
- backport the GPT-5.6 docs and examples

The upstream LanguageModelV4 implementation was adapted to the v6
LanguageModelV3 prompt and file shapes. The GPT-5.6 model prerequisite
is already present through #17022.

## Test plan

- `pnpm test:node` in `packages/openai` — 15 files, 712 tests
- `pnpm test:edge` in `packages/openai` — 15 files, 712 tests
- `pnpm test:node` in `packages/azure` — 1 file, 62 tests
- `pnpm test:edge` in `packages/azure` — 1 file, 62 tests
- `pnpm type-check` in `packages/openai`
- `pnpm type-check:full`
- dependency-closure builds for OpenAI and Azure
- `pnpm check`

The release branch does not contain
`tools/validate-properties-tables.mjs`; this change does not modify a
PropertiesTable. Live GPT-5.6 examples were not run because no
`OPENAI_API_KEY` was configured.

## Checklist

- [x] All commits are signed
- [x] Tests have been added / updated
- [x] Documentation has been added / updated
- [x] A patch changeset has been added
- [x] I have reviewed this pull request
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
@ai-sdk/amazon-bedrock 5.0.16 github npm
@ai-sdk/azure 4.0.11 github npm
@ai-sdk/harness 1.0.23 github npm
@ai-sdk/harness-claude-code 1.0.23 github npm
@ai-sdk/harness-codex 1.0.24 github npm
@ai-sdk/harness-deepagents 1.0.22 github npm
@ai-sdk/harness-opencode 1.0.23 github npm
@ai-sdk/harness-pi 1.0.23 github npm
@ai-sdk/openai 4.0.11 github npm
@ai-sdk/sandbox-just-bash 1.0.23 github npm
@ai-sdk/sandbox-vercel 1.0.23 github npm
@ai-sdk/workflow-harness 1.0.23 github npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants