diff --git a/lib/ai-providers.ts b/lib/ai-providers.ts index 1187f145..ec39f36a 100644 --- a/lib/ai-providers.ts +++ b/lib/ai-providers.ts @@ -244,8 +244,8 @@ function googleSamplingSettings(): { topK?: number; topP?: number } { * Supports various AI SDK providers with their unique configuration options * * Environment variables: - * - OPENAI_REASONING_EFFORT: OpenAI reasoning effort level (minimal/low/medium/high) - for o1/o3/o4/gpt-5 - * - OPENAI_REASONING_SUMMARY: OpenAI reasoning summary (auto/detailed) - auto-enabled for o1/o3/o4/gpt-5 + * - OPENAI_REASONING_EFFORT: OpenAI reasoning effort level (minimal/low/medium/high) - for the o-series and gpt-5 or later + * - OPENAI_REASONING_SUMMARY: OpenAI reasoning summary (auto/detailed) - auto-enabled for the o-series and gpt-5 or later * - ANTHROPIC_THINKING_BUDGET_TOKENS: Anthropic thinking budget in tokens (1024-64000) * - ANTHROPIC_THINKING_TYPE: Anthropic thinking type (enabled) * - GOOGLE_THINKING_BUDGET: Google Gemini 2.5 thinking budget in tokens (1024-100000) @@ -269,14 +269,9 @@ function buildProviderOptions( const reasoningEffort = process.env.OPENAI_REASONING_EFFORT const reasoningSummary = process.env.OPENAI_REASONING_SUMMARY - // OpenAI reasoning models (o1, o3, o4, gpt-5) need reasoningSummary to return thoughts - if ( - modelId && - (modelId.includes("o1") || - modelId.includes("o3") || - modelId.includes("o4") || - modelId.includes("gpt-5")) - ) { + // Reasoning models (the o-series, gpt-5 and later) need + // reasoningSummary to return thoughts + if (modelId && /^(o\d|gpt-([5-9]|[1-9]\d))/.test(modelId)) { options.openai = { // Auto-enable reasoning summary for reasoning models // Use 'auto' as default since not all models support 'detailed' @@ -686,7 +681,7 @@ function createModel( const openaiProvider = createOpenAI(opts) // A custom base URL is usually a proxy that only has Chat // Completions; the official endpoint uses the Responses API, - // which returns reasoning for gpt-5 and the o-series + // which returns reasoning for the o-series and gpt-5 or later return e.baseURL ? openaiProvider.chat(modelId) : openaiProvider(modelId) diff --git a/lib/types/model-config.ts b/lib/types/model-config.ts index 200d189f..f886e736 100644 --- a/lib/types/model-config.ts +++ b/lib/types/model-config.ts @@ -275,6 +275,10 @@ export const PROVIDER_INFO: Record< // Suggested models per provider for quick add export const SUGGESTED_MODELS: Partial> = { openai: [ + "gpt-6.1-sol", + "gpt-6-sol", + "gpt-6-luna", + "gpt-6-astra", "gpt-5.5-pro", "gpt-5.5", "gpt-5.4-pro", @@ -288,7 +292,13 @@ export const SUGGESTED_MODELS: Partial> = { "gpt-4o-mini", ], anthropic: [ - // Claude 4.8 / 4.7 / 4.6 series (latest, dateless pinned IDs) + // Claude 5 series (latest) + "claude-opus-5-5", + "claude-sonnet-5-5", + "claude-fable-5-1", + "claude-opus-5", + "claude-sonnet-5", + // Claude 4.8 / 4.7 / 4.6 series (dateless pinned IDs) "claude-opus-4-8", "claude-sonnet-4-6", "claude-haiku-4-5", @@ -366,10 +376,15 @@ export const SUGGESTED_MODELS: Partial> = { ], openrouter: [ // Anthropic + "anthropic/claude-opus-5.5", + "anthropic/claude-sonnet-5.5", + "anthropic/claude-fable-5.1", "anthropic/claude-opus-4.8", "anthropic/claude-sonnet-4.6", "anthropic/claude-haiku-4.5", // OpenAI + "openai/gpt-6.1-sol", + "openai/gpt-6-luna", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", @@ -458,6 +473,10 @@ export const SUGGESTED_MODELS: Partial> = { "default", ], gateway: [ + "anthropic/claude-opus-5.5", + "anthropic/claude-sonnet-5.5", + "openai/gpt-6.1-sol", + "openai/gpt-6-luna", "openai/gpt-5.5", "anthropic/claude-opus-4.7", "google/gemini-3.1-pro-preview", diff --git a/tests/unit/ai-providers-openai.test.ts b/tests/unit/ai-providers-openai.test.ts new file mode 100644 index 00000000..ebddfbf9 --- /dev/null +++ b/tests/unit/ai-providers-openai.test.ts @@ -0,0 +1,27 @@ +// @vitest-environment node +import { describe, expect, it } from "vitest" +import { getAIModel } from "@/lib/ai-providers" + +const summaryFor = (modelId: string) => + getAIModel({ provider: "openai", apiKey: "test-key", modelId }) + .providerOptions?.openai?.reasoningSummary + +describe("OpenAI reasoning summary", () => { + it("is on for the o-series and gpt-5 or later", () => { + for (const id of [ + "o3", + "o4-mini", + "gpt-5.5", + "gpt-6-luna", + "gpt-6.1-sol", + ]) { + expect(summaryFor(id), id).toBe("auto") + } + }) + + it("is off for older chat models", () => { + for (const id of ["gpt-4.1", "gpt-4o", "gpt-4o-mini"]) { + expect(summaryFor(id), id).toBeUndefined() + } + }) +})