Skip to content

Commit 01d7a03

Browse files
authored
feat(openai): add GPT-6.1 Terra model support (#24081)
## Background OpenAI released GPT-6.1 Terra. It is the same model family as GPT-6.1 Sol, but it accepts `reasoningEffort: 'none'`, and at `none` it also accepts `temperature`, `topP`, and logprobs. The AI SDK's capability logic only allowed `none` for GPT-6 Sol and Luna, so Terra would have had `none` rejected and those sampling parameters stripped. - https://openai.com/index/introducing-gpt-6-1-terra/ - https://developers.openai.com/api/docs/models/gpt-6.1-terra ## Summary - Added `gpt-6.1-terra` to the OpenAI chat and Responses model ID types and to the Responses reasoning model list. - Renamed the `isGpt6SolOrLuna` flag in `openai-language-model-capabilities.ts` to `isGpt6OrLaterModelWithNoneEffort` and added `gpt-6.1-terra` to it, alongside `gpt-6-sol` and `gpt-6-luna`. Within GPT-6 and later, `none` is the exception, so the flag lists the models that support it. This flag controls both the supported reasoning efforts and whether `temperature`, `topP`, and logprobs are kept at `none`. - Everything else about Terra follows the other GPT-6 models: async tool calling, mid-conversation effort changes, and flex and priority processing. - Added `openai/gpt-6.1-terra` and `openai/gpt-6.1-terra-fast` to the AI Gateway model IDs. ## End-to-End Verification Verified against the live OpenAI API: - Both new examples ran and returned text with `finishReason: stop`, through the Responses API (`generate-text` and `stream-text`). - With `reasoningEffort: 'none'` and `temperature` and `topP` set, a call succeeded with no warnings on both the Responses API and Chat Completions. - With `reasoningEffort: 'max'`, `temperature` was dropped and a warning was emitted, as expected. - Both `openai/gpt-6.1-terra` and `openai/gpt-6.1-terra-fast` returned responses through AI Gateway.
1 parent 22b4461 commit 01d7a03

10 files changed

Lines changed: 83 additions & 8 deletions

File tree

‎.changeset/fresh-terras-arrive.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@ai-sdk/openai': patch
3+
'@ai-sdk/gateway': patch
4+
---
5+
6+
feat(openai): add GPT-6.1 Terra model support

‎content/providers/01-ai-sdk-providers/03-openai.mdx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ The following provider options are available:
245245
Reasoning effort for reasoning models. Defaults to `medium`. If you use `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
246246

247247
<Note>
248-
Supported reasoning efforts vary by model. GPT-5.6, GPT-6 Sol, and GPT-6 Luna
249-
support `'none'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`, and `'max'`. GPT-6
250-
Astra and GPT-6.1 Sol do not support `'none'`.
248+
Supported reasoning efforts vary by model. GPT-5.6, GPT-6 Sol, GPT-6 Luna, and
249+
GPT-6.1 Terra support `'none'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`, and
250+
`'max'`. GPT-6 Astra and GPT-6.1 Sol do not support `'none'`.
251251
</Note>
252252

253253
<Note type="warning">
@@ -3069,6 +3069,7 @@ The following optional provider options are available for OpenAI completion mode
30693069
| --------------------- | ----------- | ----------- | ----------------- | ---------- |
30703070
| `gpt-6-astra` | <Check /> | <Cross /> | <Check /> | <Check /> |
30713071
| `gpt-6.1-sol` | <Check /> | <Cross /> | <Check /> | <Check /> |
3072+
| `gpt-6.1-terra` | <Check /> | <Cross /> | <Check /> | <Check /> |
30723073
| `gpt-6-luna` | <Check /> | <Cross /> | <Check /> | <Check /> |
30733074
| `gpt-6-sol` | <Check /> | <Cross /> | <Check /> | <Check /> |
30743075
| `gpt-5.6` | <Check /> | <Cross /> | <Check /> | <Check /> |

‎content/providers/01-ai-sdk-providers/index.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Not all providers support all AI SDK features. Here's a quick comparison of the
2727
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3-mini` | <Cross /> | <Check /> | <Check /> | <Check /> |
2828
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-astra` | <Check /> | <Check /> | <Check /> | <Check /> |
2929
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6.1-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
30+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6.1-terra` | <Check /> | <Check /> | <Check /> | <Check /> |
3031
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-luna` | <Check /> | <Check /> | <Check /> | <Check /> |
3132
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
3233
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6` | <Check /> | <Check /> | <Check /> | <Check /> |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { openai } from '@ai-sdk/openai';
2+
import { generateText } from 'ai';
3+
import { run } from '../../lib/run';
4+
5+
run(async () => {
6+
const result = await generateText({
7+
model: openai('gpt-6.1-terra'),
8+
prompt: 'Describe a new holiday in one sentence.',
9+
maxOutputTokens: 128,
10+
maxRetries: 0,
11+
providerOptions: { openai: { reasoningEffort: 'low' } },
12+
});
13+
14+
console.log(result.text);
15+
console.log('Token usage:', result.usage);
16+
console.log('Finish reason:', result.finishReason);
17+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { openai } from '@ai-sdk/openai';
2+
import { streamText } from 'ai';
3+
import { run } from '../../lib/run';
4+
5+
run(async () => {
6+
const result = streamText({
7+
model: openai('gpt-6.1-terra'),
8+
prompt: 'Describe a new holiday in one sentence.',
9+
maxOutputTokens: 128,
10+
maxRetries: 0,
11+
providerOptions: { openai: { reasoningEffort: 'low' } },
12+
});
13+
14+
for await (const text of result.textStream) {
15+
process.stdout.write(text);
16+
}
17+
console.log();
18+
console.log('Token usage:', await result.usage);
19+
console.log('Finish reason:', await result.finishReason);
20+
});

‎packages/gateway/src/gateway-language-model-settings.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ export type GatewayModelId =
247247
| 'openai/gpt-6.1-sol'
248248
| 'openai/gpt-6.1-sol-batch'
249249
| 'openai/gpt-6.1-sol-fast'
250+
| 'openai/gpt-6.1-terra'
251+
| 'openai/gpt-6.1-terra-fast'
250252
| 'openai/gpt-oss-120b'
251253
| 'openai/gpt-oss-20b'
252254
| 'openai/gpt-oss-safeguard-120b'

‎packages/openai/src/chat/openai-chat-language-model-options.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export type OpenAIChatModelId =
7272
| 'gpt-5.6-terra'
7373
| 'gpt-6-astra'
7474
| 'gpt-6.1-sol'
75+
| 'gpt-6.1-terra'
7576
| 'gpt-6-luna'
7677
| 'gpt-6-sol'
7778
| (string & {});

‎packages/openai/src/openai-language-model-capabilities.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ describe('getOpenAILanguageModelCapabilities', () => {
100100
['gpt-5.100', true],
101101
['gpt-6-sol', true],
102102
['gpt-6-luna', true],
103+
['gpt-6.1-terra', true],
103104
['gpt-6-astra', false],
105+
['gpt-6.1-sol', false],
104106
['gpt-99', false],
105107
['gpt-5', false],
106108
['gpt-5.0', false],
@@ -135,6 +137,26 @@ describe('getOpenAILanguageModelCapabilities', () => {
135137
});
136138
});
137139

140+
it('supports the documented GPT-6.1 Terra capabilities', () => {
141+
expect(getOpenAILanguageModelCapabilities('gpt-6.1-terra')).toEqual({
142+
isReasoningModel: true,
143+
systemMessageMode: 'developer',
144+
supportsFlexProcessing: true,
145+
supportsPriorityProcessing: true,
146+
supportsConfigurationUpdate: true,
147+
supportsAsyncToolCalling: true,
148+
supportedReasoningEfforts: [
149+
'none',
150+
'low',
151+
'medium',
152+
'high',
153+
'xhigh',
154+
'max',
155+
],
156+
supportsNonReasoningParameters: true,
157+
});
158+
});
159+
138160
it.each([
139161
['gpt-5.6', false],
140162
['gpt-6-astra', true],

‎packages/openai/src/openai-language-model-capabilities.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ export function getOpenAILanguageModelCapabilities(
2424
const isGptNanoModel = gptVersion?.variant?.startsWith('nano') ?? false;
2525
const isGpt6OrLaterModel = gptVersion != null && gptVersion.major >= 6;
2626

27-
const isGpt6SolOrLuna = modelId === 'gpt-6-sol' || modelId === 'gpt-6-luna';
27+
const isGpt6OrLaterModelWithNoneEffort =
28+
modelId === 'gpt-6-sol' ||
29+
modelId === 'gpt-6-luna' ||
30+
modelId === 'gpt-6.1-terra';
2831

2932
const supportsFlexProcessing =
3033
(oSeriesVersion != null && oSeriesVersion >= 3) ||
@@ -45,10 +48,10 @@ export function getOpenAILanguageModelCapabilities(
4548
(gptVersion != null && gptVersion.major >= 5 && !isGptChatModel);
4649

4750
// https://platform.openai.com/docs/guides/latest-model#gpt-5-1-parameter-compatibility
48-
// GPT-5.1 through GPT-5.x and GPT-6 Sol/Luna support temperature,
49-
// topP, and logProbs when reasoningEffort is none.
51+
// GPT-5.1 through GPT-5.x, GPT-6 Sol/Luna, and GPT-6.1 Terra support
52+
// temperature, topP, and logProbs when reasoningEffort is none.
5053
const supportsNonReasoningParameters =
51-
isGpt6SolOrLuna ||
54+
isGpt6OrLaterModelWithNoneEffort ||
5255
(!isGpt6OrLaterModel &&
5356
gptVersion != null &&
5457
(gptVersion.major > 5 ||
@@ -61,7 +64,7 @@ export function getOpenAILanguageModelCapabilities(
6164
supportsPriorityProcessing,
6265
supportsConfigurationUpdate: isGpt6OrLaterModel,
6366
supportsAsyncToolCalling: isGpt6OrLaterModel,
64-
supportedReasoningEfforts: isGpt6SolOrLuna
67+
supportedReasoningEfforts: isGpt6OrLaterModelWithNoneEffort
6568
? ['none', 'low', 'medium', 'high', 'xhigh', 'max']
6669
: isGpt6OrLaterModel
6770
? ['low', 'medium', 'high', 'xhigh', 'max']

‎packages/openai/src/responses/openai-responses-language-model-options.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const openaiResponsesReasoningModelIds = [
5959
'gpt-5.6-terra',
6060
'gpt-6-astra',
6161
'gpt-6.1-sol',
62+
'gpt-6.1-terra',
6263
'gpt-6-luna',
6364
'gpt-6-sol',
6465
] as const;
@@ -135,6 +136,7 @@ export type OpenAIResponsesModelId =
135136
| 'gpt-5.6-terra'
136137
| 'gpt-6-astra'
137138
| 'gpt-6.1-sol'
139+
| 'gpt-6.1-terra'
138140
| 'gpt-6-luna'
139141
| 'gpt-6-sol'
140142
| 'gpt-5-2025-08-07'

0 commit comments

Comments
 (0)