Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ export const AIAssistant = ({ className }: AIAssistantProps) => {
const selectedModel = useMemo<AssistantModel>(() => {
// While entitlements are loading, use the stored model without enforcing access
if (isLoadingEntitlements) {
return snap.model ?? 'gpt-5-mini'
return snap.model ?? 'gpt-5.4-nano'
}

const defaultModel: AssistantModel = hasAccessToAdvanceModel ? 'gpt-5' : 'gpt-5-mini'
const defaultModel: AssistantModel = hasAccessToAdvanceModel ? 'gpt-5.3-codex' : 'gpt-5.4-nano'
const model = snap.model ?? defaultModel

if (!hasAccessToAdvanceModel && model === 'gpt-5') {
return 'gpt-5-mini'
if (!hasAccessToAdvanceModel && model === 'gpt-5.3-codex') {
return 'gpt-5.4-nano'
}

return model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export interface FormProps {
/* If currently editing an existing message */
isEditing?: boolean
/* The currently selected AI model */
selectedModel: 'gpt-5' | 'gpt-5-mini'
selectedModel: 'gpt-5.3-codex' | 'gpt-5.4-nano'
/* Callback when a model is chosen */
onSelectModel: (model: 'gpt-5' | 'gpt-5-mini') => void
onSelectModel: (model: 'gpt-5.3-codex' | 'gpt-5.4-nano') => void
}

const AssistantChatFormComponent = forwardRef<HTMLFormElement, FormProps>(
Expand Down
26 changes: 13 additions & 13 deletions apps/studio/components/ui/AIAssistantPanel/ModelSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
import { useCheckEntitlements } from '@/hooks/misc/useCheckEntitlements'

interface ModelSelectorProps {
selectedModel: 'gpt-5' | 'gpt-5-mini'
onSelectModel: (model: 'gpt-5' | 'gpt-5-mini') => void
selectedModel: 'gpt-5.3-codex' | 'gpt-5.4-nano'
onSelectModel: (model: 'gpt-5.3-codex' | 'gpt-5.4-nano') => void
}

export const ModelSelector = ({ selectedModel, onSelectModel }: ModelSelectorProps) => {
Expand All @@ -35,8 +35,8 @@ export const ModelSelector = ({ selectedModel, onSelectModel }: ModelSelectorPro

const upgradeHref = `/org/${slug ?? '_'}/billing?panel=subscriptionPlan&source=ai-assistant-model`

const handleSelectModel = (model: 'gpt-5' | 'gpt-5-mini') => {
if (model === 'gpt-5' && !hasAccessToAdvanceModel) {
const handleSelectModel = (model: 'gpt-5.3-codex' | 'gpt-5.4-nano') => {
if (model === 'gpt-5.3-codex' && !hasAccessToAdvanceModel) {
setOpen(false)
void router.push(upgradeHref)
return
Expand All @@ -62,21 +62,21 @@ export const ModelSelector = ({ selectedModel, onSelectModel }: ModelSelectorPro
<CommandList_Shadcn_>
<CommandGroup_Shadcn_>
<CommandItem_Shadcn_
value="gpt-5-mini"
onSelect={() => handleSelectModel('gpt-5-mini')}
value="gpt-5.4-nano"
onSelect={() => handleSelectModel('gpt-5.4-nano')}
className="flex justify-between"
>
<span>gpt-5-mini</span>
{selectedModel === 'gpt-5-mini' && <Check className="h-3.5 w-3.5" />}
<span>gpt-5.4-nano</span>
{selectedModel === 'gpt-5.4-nano' && <Check className="h-3.5 w-3.5" />}
</CommandItem_Shadcn_>
<CommandItem_Shadcn_
value="gpt-5"
onSelect={() => handleSelectModel('gpt-5')}
value="gpt-5.3-codex"
onSelect={() => handleSelectModel('gpt-5.3-codex')}
className="flex justify-between"
>
<span>gpt-5</span>
<span>gpt-5.3-codex</span>
{hasAccessToAdvanceModel ? (
selectedModel === 'gpt-5' ? (
selectedModel === 'gpt-5.3-codex' ? (
<Check className="h-3.5 w-3.5" />
) : null
) : (
Expand All @@ -89,7 +89,7 @@ export const ModelSelector = ({ selectedModel, onSelectModel }: ModelSelectorPro
</div>
</TooltipTrigger>
<TooltipContent side="right">
gpt-5 is available on Pro plans and above
gpt-5.3-codex is available on Pro plans and above
</TooltipContent>
</Tooltip>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/evals/assistant.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Eval('Assistant', {
data: () => dataset,
task: async (input) => {
const result = await generateAssistantResponse({
model: openai('gpt-5-mini'),
model: openai('gpt-5.4-nano'),
messages: [{ id: '1', role: 'user', parts: [{ type: 'text', text: input.prompt }] }],
tools: await getMockTools(input.mockTables ? { list_tables: input.mockTables } : undefined),
})
Expand Down
10 changes: 5 additions & 5 deletions apps/studio/lib/ai/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ describe('getModel', () => {
})

expect(model).toEqual('openai-model')
// Default openai model in registry is gpt-5-mini
expect(openai).toHaveBeenCalledWith('gpt-5-mini')
// Default openai model in registry is gpt-5.4-nano
expect(openai).toHaveBeenCalledWith('gpt-5.4-nano')
expect(promptProviderOptions).toBeUndefined()
})

Expand All @@ -80,20 +80,20 @@ describe('getModel', () => {
expect(error).toEqual(new Error(ModelErrorMessage))
})

it('returns specified provider and model when provided (openai gpt-5)', async () => {
it('returns specified provider and model when provided (openai gpt-5.3-codex)', async () => {
vi.mocked(bedrockModule.checkAwsCredentials).mockResolvedValue(false)
process.env.OPENAI_API_KEY = 'test-key'
process.env.IS_THROTTLED = 'false'

const { model, error } = await getModel({
provider: 'openai',
model: 'gpt-5',
model: 'gpt-5.3-codex',
routingKey: 'rk',
isLimited: false,
})

expect(error).toBeUndefined()
expect(model).toEqual('openai-model')
expect(openai).toHaveBeenCalledWith('gpt-5')
expect(openai).toHaveBeenCalledWith('gpt-5.3-codex')
})
})
6 changes: 3 additions & 3 deletions apps/studio/lib/ai/model.utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('model.utils', () => {

it('should return correct default for openai provider', () => {
const result = getDefaultModelForProvider('openai')
expect(result).toBe('gpt-5-mini')
expect(result).toBe('gpt-5.4-nano')
})

it('should return correct default for anthropic provider', () => {
Expand All @@ -39,8 +39,8 @@ describe('model.utils', () => {
it('should have openai provider with models', () => {
expect(PROVIDERS.openai).toBeDefined()
expect(PROVIDERS.openai.models).toBeDefined()
expect(Object.keys(PROVIDERS.openai.models)).toContain('gpt-5')
expect(Object.keys(PROVIDERS.openai.models)).toContain('gpt-5-mini')
expect(Object.keys(PROVIDERS.openai.models)).toContain('gpt-5.3-codex')
expect(Object.keys(PROVIDERS.openai.models)).toContain('gpt-5.4-nano')
})

it('should have anthropic provider with models', () => {
Expand Down
6 changes: 3 additions & 3 deletions apps/studio/lib/ai/model.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type ProviderName = 'bedrock' | 'openai' | 'anthropic'

export type BedrockModel = 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'openai.gpt-oss-120b-1:0'

export type OpenAIModel = 'gpt-5' | 'gpt-5-mini'
export type OpenAIModel = 'gpt-5.3-codex' | 'gpt-5.4-nano'

export type AnthropicModel = 'claude-sonnet-4-20250514' | 'claude-3-5-haiku-20241022'

Expand Down Expand Up @@ -49,8 +49,8 @@ export const PROVIDERS: ProviderRegistry = {
},
openai: {
models: {
'gpt-5': { default: false },
'gpt-5-mini': { default: true },
'gpt-5.3-codex': { default: false },
'gpt-5.4-nano': { default: true },
},
providerOptions: {
openai: {
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/pages/api/ai/sql/generate-v4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const requestBodySchema = z.object({
chatId: z.string().optional(),
chatName: z.string().optional(),
orgSlug: z.string().optional(),
model: z.enum(['gpt-5', 'gpt-5-mini']).optional(),
model: z.enum(['gpt-5.3-codex', 'gpt-5.4-nano']).optional(),
})

async function handlePost(req: NextApiRequest, res: NextApiResponse, claims?: JwtPayload) {
Expand Down Expand Up @@ -135,7 +135,7 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse, claims?: Jw
providerOptions,
} = await getModel({
provider: 'openai',
model: requestedModel ?? 'gpt-5',
model: requestedModel ?? 'gpt-5.3-codex',
routingKey: projectRef,
isLimited,
})
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/state/ai-assistant-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type AssistantMessageType = MessageType

export type SqlSnippet = string | { label: string; content: string }

export type AssistantModel = 'gpt-5' | 'gpt-5-mini'
export type AssistantModel = 'gpt-5.3-codex' | 'gpt-5.4-nano'

type ChatSession = {
id: string
Expand Down Expand Up @@ -64,7 +64,7 @@ const INITIAL_AI_ASSISTANT: AiAssistantData = {
tables: [],
chats: {},
activeChatId: undefined,
model: 'gpt-5',
model: 'gpt-5.3-codex',
context: {},
}

Expand Down
Loading