Set gpt5 max tokens to 8_192 to fix context window exceeded error (#5478)

* Set gpt5 max tokens to 8_192 to fix context window exceeded error

* Create healthy-crabs-sip.md
This commit is contained in:
Saoud Rizwan authored and GitHub committed 2025-08-11 15:50:32 -07:00
1 parent 669e018b85
commit 2cf1d8628b
3 files changed
+15 -4

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Set gpt5 max tokens to 8_192 to fix 'context window exceeded' error
@@ -115,6 +115,12 @@ export async function refreshOpenRouterModels(
modelInfo.outputPrice = 3
modelInfo.contextWindow = 131_000
break
case "openai/gpt-5":
case "openai/gpt-5-chat":
case "openai/gpt-5-mini":
case "openai/gpt-5-nano":
modelInfo.maxTokens = 8_192 // 128000 breaks context window truncation
break
default:
if (rawModel.id.startsWith("openai/")) {
modelInfo.cacheReadsPrice = parsePrice(rawModel.pricing?.input_cache_read)
+4 -4
View File
@@ -1005,7 +1005,7 @@ export type OpenAiNativeModelId = keyof typeof openAiNativeModels
export const openAiNativeDefaultModelId: OpenAiNativeModelId = "gpt-5-2025-08-07"
export const openAiNativeModels = {
"gpt-5-2025-08-07": {
maxTokens: 128000,
maxTokens: 8_192, // 128000 breaks context window truncation
contextWindow: 272000,
supportsImages: true,
supportsPromptCache: true,
@@ -1014,7 +1014,7 @@ export const openAiNativeModels = {
cacheReadsPrice: 0.125,
},
"gpt-5-mini-2025-08-07": {
maxTokens: 128000,
maxTokens: 8_192,
contextWindow: 272000,
supportsImages: true,
supportsPromptCache: true,
@@ -1023,7 +1023,7 @@ export const openAiNativeModels = {
cacheReadsPrice: 0.025,
},
"gpt-5-nano-2025-08-07": {
maxTokens: 128000,
maxTokens: 8_192,
contextWindow: 272000,
supportsImages: true,
supportsPromptCache: true,
@@ -1032,7 +1032,7 @@ export const openAiNativeModels = {
cacheReadsPrice: 0.005,
},
"nectarine-alpha-new-reasoning-effort-2025-07-25": {
maxTokens: 128000,
maxTokens: 8_192,
contextWindow: 256000,
supportsImages: true,
supportsPromptCache: true,